Requirements:
ncclient (>=v0.5.2)
jxmlease (for display=json)
xmltodict
sudo apt install ansible
ansible-galaxy collection install ansible.netcommon
ssh-keygen -m PEM -t rsa -b 4096
Command to execute
ansible-playbook uCPEprovisioning.yml -vvv
Configuration of uCPE before activation of uCPEprovisioning.yml
Configuration of uCPE after activation of uCPEprovisioning.yml
Data in the uCPEprovisioning.yml:
- hosts: dosios2102
remote_user: dosios2102
tasks:
- name: set serviceChain vRouter+vFirewall
vars:
ansible_command_timeout: 360
ansible.netcommon.netconf_config:
content: |
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<ecp xmlns="urn:dosi.shytyi.net:mgmt:ecp:1">
# Section to configure OVS bridges
<switches>
<switch>swLan</switch>
<ports>
<port>0</port>
<cvlans>None</cvlans>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
<vm>vFirewall</vm>
<vm-port>2</vm-port>
</ports>
<ports>
<port>1</port>
<cvlans>None</cvlans>
<interface>vfp1</interface>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
</ports>
</switches>
<switches>
<switch>swWan</switch>
<ports>
<port>1</port>
<cvlans>None</cvlans>
<interface>vfp2</interface>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
</ports>
<ports>
<port>2</port>
<cvlans>None</cvlans>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
<vm>vRouter</vm>
<vm-port>1</vm-port>
</ports>
</switches>
<switches>
<switch>swService</switch>
<ports>
<port>1</port>
<cvlans>None</cvlans>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
<vm>vRouter</vm>
<vm-port>2</vm-port>
</ports>
<ports>
<port>2</port>
<cvlans>None</cvlans>
<n-rxq>4</n-rxq>
<n-txq>4</n-txq>
<port-mode>default</port-mode>
<stacked-mode>802.1q</stacked-mode>
<tag>None</tag>
<vm>vFirewall</vm>
<vm-port>1</vm-port>
</ports>
</switches>
# Secrion to configure Service Functions
<vms>
<vm>vFirewall</vm>
<boot-from>cdrom</boot-from>
<cpu>4</cpu>
<devices>
<device>0</device>
<drive>
<bus-type>virtio</bus-type>
<drive-type>cdrom</drive-type>
<file>http://192.168.5.1/vRouter.iso</file>
</drive>
</devices>
<if-nmbr>4</if-nmbr>
<queues-nmbr>8</queues-nmbr>
<queues-size>256</queues-size>
<ram>4</ram>
</vms>
<vms>
<vm>vRouter</vm>
<boot-from>cdrom</boot-from>
<cpu>4</cpu>
<devices>
<device>0</device>
<drive>
<bus-type>virtio</bus-type>
<drive-type>cdrom</drive-type>
<file>http://192.168.5.1/vRouter.iso</file>
</drive>
</devices>
<if-nmbr>4</if-nmbr>
<queues-nmbr>8</queues-nmbr>
<queues-size>256</queues-size>
<ram>4</ram>
</vms>
</ecp>
</config>