Camphor Networks Platform API
camphor_api.camphor_api_test Namespace Reference

Functions

def test1_simple_network ()
 Create a simple network connecting routers. More...
 
def test2_linear_topology ()
 Create a simple linear topology of SONiC Devices. More...
 
def test3_custom_topology ()
 Create a customized network topology. More...
 
def test4_circular_topology (int count=10)
 Create a simple circular topology of NXOS Devices. More...
 
def test5_device_for_analytics (int device_count=4, int network_count=2)
 Create a network with better management traffic capable devices. More...
 
def test6_multi_device_networks (int device_count=4, int network_count=4)
 Create a network with better management traffic capable devices. More...
 
def test7_camphor_topology_file ()
 Load a camphor network topology from an external yaml file. More...
 
def test8_small_datacenter ()
 Create a small data center network. More...
 
def test9_medium_datacenter ()
 Create a medium sized data center network. More...
 
def test10_large_datacenter ()
 Create a large sized data center network. More...
 
def test11_customized_datacenter ()
 Create a customized data center network. More...
 
def test12_ospf_basic (bool synchronize=False)
 Create a simple OSPF Topology of JUNOS Routers. More...
 
def test13_device_with_pci_passthrough (int device_count=4)
 Create devices with PCI Cards pass through from underlying host such as GPUs, NPUs and IPUs. More...
 
def test14_device_with_k8_pods (int device_count=int(environ.get('CAMPHOR_TEST_DEVICE_COUNT', '4')), int network_count=int(environ.get('CAMPHOR_TEST_NETWORK_COUNT', '4')), bool synchronize=environ.get('CAMPHOR_TEST_SYNCHRONIZE', '').upper()=='TRUE')
 Create a network of devices and verify wih K8. More...
 
def test15_device_pause (str name='router', int count=4)
 Pause devices. More...
 
def test16_device_resume (str name='router', int count=4)
 Resume devices. More...
 
def test17_device_shutdown (str name='router', int count=4)
 Shutdown devices. More...
 
def test18_device_restart (str name='router', int count=4)
 Restart devices. More...
 
def test19_device_recreate (str name='router', int count=4)
 Recreate devices. More...
 
def test20_device_pullconf (str name='router', int count=4)
 Pull Configuration from devices. More...
 
def test21_device_pushconf (str name='router', int count=4)
 Push Configuration to devices. More...
 
def test22_device_interface_link_down (str name='router', int count=4)
 Turn down interface link state. More...
 
def test23_device_interface_link_up (str name='router', int count=4)
 Turn up interface link state. More...
 
def test24_device_interface_admin_down (str name='router', int count=4)
 Turn down interface admin state. More...
 
def test25_device_interface_admin_up (str name='router', int count=4)
 Turn up interface admin state. More...
 
def test26_application_drawio ()
 Create application DrawIO Diagrams Editor. More...
 
def test27_application_grafana ()
 Create application Grafana Graphs Generator. More...
 
def test28_application_jenkins ()
 Create application Jenkins Jobs Manager. More...
 
def test29_application_jupyter_notebook ()
 Create application Jupyter Notebook for Easy Automation. More...
 
def test30_application_kibana ()
 Create application Elastic Search Based Kibana Logs Analyzer. More...
 
def test31_application_novnc ()
 Create application noVNC Remote Desktop for Ubuntu Linux. More...
 
def test32_application_opennms ()
 Create application OpenNMS Network Management Station. More...
 
def test33_application_suzieq ()
 Create application SuzieQ Network Analytics Manager, especially for Data Centers. More...
 
def test34_application_wordpress ()
 Create application WordPress WebSite Hosting Platform. More...
 
def test35_datacenter_cisco ()
 Load a cisco network topology from an external yaml file. More...
 
def test36_datacenter_convergeone ()
 Load a convergeone network topology from an external yaml file. More...
 
def test37_datacenter_aviz ()
 Load a aviz network topology from an external yaml file. More...
 
def test38_datacenter_augtera ()
 Load a augtera network topology from an external yaml file. More...
 
def test39_datacenter_junos ()
 Load a junos network topology from an external yaml file. More...
 
def test40_datacenter_arrcus ()
 Load a arrcus network topology from an external yaml file. More...
 
def test41_datacenter_arista ()
 Load a arista network topology from an external yaml file. More...
 
def test42_datacenter_sonic ()
 Load a sonic network topology from an external yaml file. More...
 
def test43_kubernetes_cluster1 (int masters=-1, int computes=3)
 Create a Kubernetes Cluster. More...
 
def test44_aviz_ones_controller_based_datacenter ()
 Create a Aviz-Ones-Controller driven Virtual Data Center. More...
 

Function Documentation

◆ test1_simple_network()

def camphor_api.camphor_api_test.test1_simple_network ( )

Create a simple network connecting routers.

Two SONiC Routers are created and connected with each other.

You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  item:
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router1
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router2
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
    name: network1

Definition at line 59 of file camphor_api_test.py.

60  # Create CamphorManager object to manage the platform.
61  manager = CamphorManager()
62 
63  devices = ['router1', 'router2']
64  manager.deviceManager.createDevices(name=devices[0], os=DeviceOS.SONiC)
65  manager.deviceManager.createDevices(name=devices[1], os=DeviceOS.SONiC)
66 
67  # Create a network to connect the routers.
68  networks = ['network1']
69  manager.networkManager.createNetworks(name=networks[0], devices=devices)
70 
71  # Convert the created entities into a dictionary and verify.
72  entries = manager.toDict()
73 
74  # Verify that 2 devices and 1 network were indeed created in the Yaml configuration structure.
75  assert len(entries['devices']['item']) == 2
76  assert len(entries['networks']['item']) == 1
77  manager.toYaml()
78 
79  # Load the configuration onto the camphor controller.
80  assert manager.loadYaml()[1] == 0
81 
82  # Verify that devices are indeed created at the camphor controller.
83  manager.verifyCamphorEntities(devices=devices, networks=networks)
84 
85 
def test1_simple_network()
Create a simple network connecting routers.

◆ test2_linear_topology()

def camphor_api.camphor_api_test.test2_linear_topology ( )

Create a simple linear topology of SONiC Devices.

SONiC Routers are created and chained in a serial manner. Generated yaml is loaded onto the camphor controller.

You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  item:
  - attributes:
      image:
        file:
        - master:///local/camphor/vm_image.qcow2
        md5sum:
        - deadbeef
      os: SONiC
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 4096
      type: dedicatedVM
    name: router1
  - attributes:
      image:
        file:
        - master:///local/camphor/vm_image.qcow2
        md5sum:
        - deadbeef
      os: SONiC
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 4096
      type: dedicatedVM
    name: router2
  - attributes:
      image:
        file:
        - master:///local/camphor/vm_image.qcow2
        md5sum:
        - deadbeef
      os: SONiC
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 4096
      type: dedicatedVM
    name: router3
  - attributes:
      image:
        file:
        - master:///local/camphor/vm_image.qcow2
        md5sum:
        - deadbeef
      os: SONiC
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 4096
      type: dedicatedVM
    name: router4
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
    name: network1
  - attributes:
      ports:
        item:
        - device: router2
        - device: router3
    name: network2
  - attributes:
      ports:
        item:
        - device: router3
        - device: router4
    name: network3

Definition at line 96 of file camphor_api_test.py.

97  # Create CamphorManager object to manage the platform.
98  manager = CamphorManager()
99 
100  # Set number of devices to be created.
101  count = 4
102 
103  # Create {count} SONiC Devices configuration.
104  manager.deviceManager.createDevices(name='router', count=count, os=DeviceOS.SONiC,
105  image=Image(file=['master:///local/camphor/vm_image.qcow2'],
106  md5sum=['deadbeef']),
107  resource=Resource(cpu=[4], memory=[4096], disk=[200]))
108 
109  # Connect the devices in a serial daisy-chain fashion.
110  devices = []
111  networks = []
112  for i in range(1, count):
113  # Create a network to connect a router to the next. An available interface is automatically picked.
114  devices.append(F"router{i}")
115  networks.append(F"network{i}")
116  manager.networkManager.createNetworks(name=F"network{i}", devices=[F"router{i}", F"router{i + 1}"])
117 
118  devices.append(F"router{count}")
119 
120  # Convert the created entities into a dictionary and verify.
121  entries = manager.toDict()
122 
123  # Verify that {count} devices and {count-1} networks were indeed created in the Yaml configuration structure.
124  assert len(entries['devices']['item']) == count
125  assert len(entries['networks']['item']) == count - 1
126  manager.toYaml()
127 
128  # Load the configuration onto the camphor controller.
129  assert manager.loadYaml()[1] == 0
130 
131  # Verify that devices are indeed created at the camphor controller.
132  manager.verifyCamphorEntities(devices=devices, networks=networks)
133 
134 
def test2_linear_topology()
Create a simple linear topology of SONiC Devices.

◆ test3_custom_topology()

def camphor_api.camphor_api_test.test3_custom_topology ( )

Create a customized network topology.

Create routers by customizing image, resource and other attributes. Connect the routers together via specific network interfaces to build a custom topology. You can see the auto-generated topology in the camphor dashboard. e.g. https://camphor-k8-master/#/camphorTopology/camphor-administrator-default/autogenerated?namespace=camphor-administrator-default

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: a1
  - attributes:
      name: jupyter
    name: a2
devices:
  attributes:
    os: LINUX_ALPINE
    resource:
      cpu:
      - 2
      disk:
      - 50
      memory:
      - 1024
  item:
  - attributes:
      image:
        file:
        - master:///local/camphor/customer/vms/vm_image.qcow2
        md5sum:
        - deadbeef
      os: SONiC
      resource:
        cpu:
        - 4
        disk:
        - 100
        memory:
        - 2048
    name: router1
  - attributes:
      conf: master:///local/camphor/$CAMPHOR_CLUSTER/$CAMPHOR_USERNAME/$CAMPHOR_PROJECT/$CAMPHOR_DEVICE/device.conf
      image:
        file:
        - master:///local/camphor/customer/vms/vm_re_image.qcow2
        - master:///local/camphor/customer/vms/vm_pfe_image.qcow2
        md5sum:
        - deadbeef
        - beefbeef
      os: MX
      resource:
        cpu:
        - 4
        disk:
        - 100
        memory:
        - 4096
    name: router2
  - name: router3
networks:
  attributes:
    portAttributes:
      interface: autoAssign
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
    name: net1
  - attributes:
      ports:
        item:
        - attributes:
            interface: ge-0/0/2
          device: router2
        - attributes:
            interface: ge-0/0/4
          device: router3
    name: net2
  - attributes:
      ports:
        item:
        - device: router1
        - device: router3
    name: net3

Definition at line 146 of file camphor_api_test.py.

147  # Create CamphorManager object to manage the platform.
148  manager = CamphorManager()
149 
150  # Set default attributes.
151  manager.deviceManager.getDeviceCommonAttributes().resource = Resource(cpu=[2], memory=[1024], disk=[50])
152  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.LINUXALPINE
153 
154  # Create a few devices.
155  manager.deviceManager.createDevice(name='router1', attributes=DeviceAttributesDefinition(
156  os=DeviceOS.SONiC, resource=Resource(cpu=[4], memory=[2048], disk=[100]),
157  image=Image(file=["master:///local/camphor/customer/vms/vm_image.qcow2"], md5sum=["deadbeef"])
158  ))
159  manager.deviceManager.createDevice(name='router2', attributes=DeviceAttributesDefinition(
160  os=DeviceOS.MX,
161  conf="master:///local/camphor/$CAMPHOR_CLUSTER/$CAMPHOR_USERNAME/$CAMPHOR_PROJECT/$CAMPHOR_DEVICE/device.conf",
162  resource=Resource(cpu=[4], memory=[4096], disk=[100]),
163  image=Image(file=[
164  "master:///local/camphor/customer/vms/vm_re_image.qcow2",
165  "master:///local/camphor/customer/vms/vm_pfe_image.qcow2",
166  ], md5sum=["deadbeef", "beefbeef"])
167  ))
168  manager.deviceManager.createDevice(name='router3')
169 
170  # Connect the devices over desired interfaces to form the required network topology.
171  manager.networkManager.getNetworkCommonAttributes().portAttributes = NetworkPortAttributesDefinition(
172  interface='autoAssign')
173  manager.networkManager.createNetwork(name='net1', attributes=NetworkAttributesDefinition(ports=Ports(item=[
174  PortsItem(device='router1'),
175  PortsItem(device='router2')
176  ])))
177  manager.networkManager.createNetwork(name='net2', attributes=NetworkAttributesDefinition(ports=Ports(item=[
178  PortsItem(device='router2', attributes=NetworkPortAttributesDefinition(interface='ge-0/0/2')),
179  PortsItem(device='router3', attributes=NetworkPortAttributesDefinition(interface='ge-0/0/4'))
180  ])))
181  manager.networkManager.createNetwork(name='net3', attributes=NetworkAttributesDefinition(ports=Ports(item=[
182  PortsItem(device='router1'),
183  PortsItem(device='router3')
184  ])))
185 
186  # Add some applications as well!
187  manager.applicationManager.createApplication(name='a1', attributes=ApplicationAttributesDefinition(
188  name=ApplicationName.novnc))
189  manager.applicationManager.createApplication(name='a2', attributes=ApplicationAttributesDefinition(
190  name=ApplicationName.jupyter))
191 
192  entries = manager.toDict()
193  assert len(entries['devices']['item']) == 3
194  assert len(entries['networks']['item']) == 3
195  assert len(entries['applications']['item']) == 2
196 
197  assert entries['devices']['item'][0]['attributes']['os'] == DeviceOS.SONiC.name
198  assert entries['devices']['item'][1]['attributes']['os'] == DeviceOS.MX.name
199  assert entries['devices']['item'][1]['attributes']['image']['file'][0] == \
200  "master:///local/camphor/customer/vms/vm_re_image.qcow2"
201  assert entries['devices']['item'][1]['attributes']['image']['file'][1] == \
202  "master:///local/camphor/customer/vms/vm_pfe_image.qcow2"
203  assert manager.loadYaml()[1] == 0
204 
205  manager.deviceManager.deleteDevice(name='router2')
206  manager.networkManager.deleteNetwork(name='net1')
207  manager.applicationManager.deleteApplication(name='a1')
208  entries = manager.toDict()
209  assert len(entries['devices']['item']) == 2
210  assert len(entries['networks']['item']) == 2
211  assert len(entries['applications']['item']) == 1
212 
213 
def test3_custom_topology()
Create a customized network topology.

◆ test4_circular_topology()

def camphor_api.camphor_api_test.test4_circular_topology ( int   count = 10)

Create a simple circular topology of NXOS Devices.

NXOS Routers are created and chained in a circular manner. Generated yaml is loaded onto the camphor controller.

You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  attributes:
    conf: |2

      hostname nxos
      snmp-server user admin
      username admin password 5 $5$j7tkn468$cxNfE/jPpWmeIjJUOTNdSHcfr47N7pSK.S4h8SGGwe. role network-admin
      username admin sshkey ssh-rsa ssh-rsa AAAAB3NzaC1yc2EA
       feature bash
      feature scp-server
      feature bgp
      feature ospf
      ip domain-lookup
       ip name-server 10.0.2.3 use-vrf management
      vlan 1
      vrf context management
        ip domain-name camphor-administrator-default
        ip name-server 10.0.2.3
        ip route 0.0.0.0/0 10.0.2.2
      interface mgmt0
        ip address dhcp
        vrf member management
      interface Eth1/1
      no description
      switchport
      line console
      line vty
      boot nxos bootflash:/boot nxos bootflash:/nxos64-cs.10.2.3.F.bin
    image:
      file:
      - master:///local/camphor/customer/vms/500v64.10.2.3.F.qcow2
      md5sum:
      - 4d541a673a097ababec96b016f9ba237
    os: NXOS
    resource:
      cpu:
      - 4
      disk:
      - 200
      memory:
      - 4048
  item:
  - name: router1
  - name: router2
  - name: router3
  - name: router4
  - name: router5
  - name: router6
  - name: router7
  - name: router8
  - name: router9
  - name: router10
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
    name: network1
  - attributes:
      ports:
        item:
        - device: router2
        - device: router3
    name: network2
  - attributes:
      ports:
        item:
        - device: router3
        - device: router4
    name: network3
  - attributes:
      ports:
        item:
        - device: router4
        - device: router5
    name: network4
  - attributes:
      ports:
        item:
        - device: router5
        - device: router6
    name: network5
  - attributes:
      ports:
        item:
        - device: router6
        - device: router7
    name: network6
  - attributes:
      ports:
        item:
        - device: router7
        - device: router8
    name: network7
  - attributes:
      ports:
        item:
        - device: router8
        - device: router9
    name: network8
  - attributes:
      ports:
        item:
        - device: router9
        - device: router10
    name: network9
  - attributes:
      ports:
        item:
        - device: router10
        - device: router1
    name: network10

Definition at line 224 of file camphor_api_test.py.

224 def test4_circular_topology(count: int = 10):
225  # Create CamphorManager object to manage the platform.
226  manager = CamphorManager()
227  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.NXOS
228  manager.deviceManager.getDeviceCommonAttributes().resource = Resource(cpu=[4], memory=[4 * 1012], disk=[200])
229  manager.deviceManager.getDeviceCommonAttributes().image = \
230  Image(file=['master:///local/camphor/customer/vms/500v64.10.2.3.F.qcow2'],
231  md5sum=['4d541a673a097ababec96b016f9ba237'])
232 
233  # noinspection SpellCheckingInspection
234  manager.deviceManager.getDeviceCommonAttributes().conf = F"""
235 hostname nxos
236 snmp-server user admin
237 username admin password 5 $5$j7tkn468$cxNfE/jPpWmeIjJUOTNdSHcfr47N7pSK.S4h8SGGwe. role network-admin
238 username admin sshkey ssh-rsa {Util.fread(F"{environ['HOME']}/.ssh/id_rsa.pub")[:24]}
239 feature bash
240 feature scp-server
241 feature bgp
242 feature ospf
243 ip domain-lookup
244 ip name-server 10.0.2.3 use-vrf management
245 vlan 1
246 vrf context management
247  ip domain-name camphor-administrator-default
248  ip name-server 10.0.2.3
249  ip route 0.0.0.0/0 10.0.2.2
250 interface mgmt0
251  ip address dhcp
252  vrf member management
253 interface Eth1/1
254 no description
255 switchport
256 line console
257 line vty
258 boot nxos bootflash:/boot nxos bootflash:/nxos64-cs.10.2.3.F.bin
259 """
260  manager.deviceManager.createDevice(name='router', count=count)
261 
262  devices = []
263  networks = []
264  for i in range(1, count + 1):
265  devices.append(F"router{i}")
266  networks.append(F"network{i}")
267  manager.networkManager.createNetworks(name=networks[i - 1],
268  devices=[F"router{i}", F"router{i + 1 if i < count else 1}"])
269  entries = manager.toDict()
270  assert len(entries['devices']['item']) == count
271  assert len(entries['networks']['item']) == count
272 
273  # Load the configuration onto the camphor controller.
274  assert manager.loadYaml()[1] == 0
275 
276  # Verify that devices are indeed created at the camphor controller.
277  manager.verifyCamphorEntities(devices=devices, networks=networks)
278 
279 
def test4_circular_topology(int count=10)
Create a simple circular topology of NXOS Devices.

◆ test5_device_for_analytics()

def camphor_api.camphor_api_test.test5_device_for_analytics ( int   device_count = 4,
int   network_count = 2 
)

Create a network with better management traffic capable devices.

Using an option

See also
passThroughInterface, device management traffic can get a high throughput over the management interface.
Warning
Please ensure that MTU is set correctly to avoid IP fragmentation, e.g. to 1376, with -124 offset from 1500
#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  attributes:
    conf: |2

      hostname nxos
      snmp-server user admin
      username admin password 5 $5$j7tkn468$cxNfE/jPpWmeIjJUOTNdSHcfr47N7pSK.S4h8SGGwe. role network-admin
      username admin sshkey ssh-rsa ssh-rsa AAAAB3NzaC1yc2EA
       feature bash
      feature scp-server
      feature bgp
      feature ospf
      ip domain-lookup
       ip name-server 10.0.2.3 use-vrf management
      vlan 1
      vrf context management
        ip domain-name camphor-administrator-default
        ip name-server 10.0.2.3
        ip route 0.0.0.0/0 10.0.2.2
      interface mgmt0
        mtu 1376
        ip address dhcp
        vrf member management
      interface Eth1/1
      no description
      switchport
      line console
      line vty
      boot nxos bootflash:/boot nxos bootflash:/nxos64-cs.10.2.3.F.bin
    os: NXOS
    passThroughInterface: true
  item:
  - name: router1
  - name: router2
  - name: router3
  - name: router4
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network1
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network2

Definition at line 291 of file camphor_api_test.py.

291 def test5_device_for_analytics(device_count: int = 4, network_count: int = 2):
292  # Create CamphorManager object to manage the platform.
293  manager = CamphorManager()
294  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.NXOS
295  manager.deviceManager.getDeviceCommonAttributes().passThroughInterface = True
296 
297  # noinspection SpellCheckingInspection
298  manager.deviceManager.getDeviceCommonAttributes().conf = F"""
299 hostname nxos
300 snmp-server user admin
301 username admin password 5 $5$j7tkn468$cxNfE/jPpWmeIjJUOTNdSHcfr47N7pSK.S4h8SGGwe. role network-admin
302 username admin sshkey ssh-rsa {Util.fread(F"{environ['HOME']}/.ssh/id_rsa.pub")[:24]}
303 feature bash
304 feature scp-server
305 feature bgp
306 feature ospf
307 ip domain-lookup
308 ip name-server 10.0.2.3 use-vrf management
309 vlan 1
310 vrf context management
311  ip domain-name camphor-administrator-default
312  ip name-server 10.0.2.3
313  ip route 0.0.0.0/0 10.0.2.2
314 interface mgmt0
315  mtu 1376
316  ip address dhcp
317  vrf member management
318 interface Eth1/1
319 no description
320 switchport
321 line console
322 line vty
323 boot nxos bootflash:/boot nxos bootflash:/nxos64-cs.10.2.3.F.bin
324 """
325  manager.deviceManager.createDevice(name='router', count=device_count)
326 
327  # Connect the devices back to back over multiple links!
328  devices = [F"router{i}" for i in range(1, device_count + 1)]
329  networks = [F"network{i}" for i in range(1, network_count + 1)]
330  for i in range(network_count):
331  manager.networkManager.createNetworks(name=networks[i], devices=devices)
332 
333  entries = manager.toDict()
334  assert len(entries['devices']['item']) == device_count
335  assert len(entries['networks']['item']) == network_count
336 
337  # Load the configuration onto the camphor controller.
338  assert manager.loadYaml()[1] == 0
339 
340  # Verify that devices are indeed created at the camphor controller.
341  manager.verifyCamphorEntities(devices=devices, networks=networks)
342 
343 
def test5_device_for_analytics(int device_count=4, int network_count=2)
Create a network with better management traffic capable devices.

◆ test6_multi_device_networks()

def camphor_api.camphor_api_test.test6_multi_device_networks ( int   device_count = 4,
int   network_count = 4 
)

Create a network with better management traffic capable devices.

Create a topology where same set of devices are created using multiple different networks. Also more than two devices are connected within each camphor network (aka connection)

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  attributes:
    os: SONiC
  item:
  - name: router1
  - name: router2
  - name: router3
  - name: router4
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network1
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network2
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network3
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network4

Definition at line 353 of file camphor_api_test.py.

353 def test6_multi_device_networks(device_count: int = 4, network_count: int = 4):
354  manager = CamphorManager()
355  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.SONiC
356  manager.deviceManager.createDevice(name='router', count=device_count)
357 
358  # Connect the devices back to back over multiple links!
359  devices = [F"router{i}" for i in range(1, device_count + 1)]
360  networks = [F"network{i}" for i in range(1, network_count + 1)]
361  for i in range(network_count):
362  manager.networkManager.createNetworks(name=networks[i], devices=devices)
363 
364  entries = manager.toDict()
365  assert len(entries['devices']['item']) == device_count
366  assert len(entries['networks']['item']) == network_count
367 
368  # Load the configuration onto the camphor controller.
369  assert manager.loadYaml()[1] == 0
370 
371  # Verify that devices are indeed created at the camphor controller.
372  manager.verifyCamphorEntities(devices=devices, networks=networks)
373 
374 
def test6_multi_device_networks(int device_count=4, int network_count=4)
Create a network with better management traffic capable devices.

◆ test7_camphor_topology_file()

def camphor_api.camphor_api_test.test7_camphor_topology_file ( )

Load a camphor network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: minimal
    name: minimal
devices:
  attributes:
    interfaces: 16
    lineCards: 1
    location:
      address1: '1957'
      address2: Limewood Dr
      city: San Jose
      country: USA
      state: California
      zip: '95132'
    os: cRPD
    resource:
      cpu:
      - 1
      - 3
      disk:
      - 100
      - 200
      memory:
      - 512
      - 2048
    routingEngines: 1
    type: dedicatedVM
    version: latest
  item:
  - attributes:
      conf: |
        system {
            host-name $CAMPHOR_DEVICE;
            root-authentication {
                encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
            }
            login {
                user admin {
                    uid 2000;
                    class super-user;
                    authentication {
                        encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                        ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
                    }
                }
            }
            services {
                ssh {
                    root-login allow;
                }
                netconf {
                    ssh;
                }
            }
            domain-search [ $CAMPHOR_NAMESPACE ];
            name-server {
                $CAMPHOR_MGMT_NAMESERVER;
            }
        }
        interfaces {
            em0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address $CAMPHOR_MGMT_SUBNET;
                    }
                }
            }
        }
        routing-options {
            static {
                route 0.0.0.0/0 next-hop $CAMPHOR_MGMT_DEFAULT_GW;
            }
        }
      image:
        file:
        - master:///root/vmx_image.qcow2
        md5sum:
        - deadbeef
      objectMeta:
        count: 4
        disable: true
      os: MX
      synchronize: true
    name: router
networks:
  item:
  - attributes:
      monitor: true
      objectMeta:
        count: -1
      ports:
        item:
        - attributes:
            igp: ospf
            interface: ge-0/0/1
            ipv4Prefix: autoAssign
            mtu: 1500
          device: router1
        - attributes:
            igp: ospf
            interface: ge-0/0/2
            ipv4Prefix: autoAssign
          device: router2
    name: network1
  - attributes:
      objectMeta:
        count: -1
      ports:
        item:
        - attributes:
            igp: ospf
            interface: ge-0/0/3
            ipv4Prefix: autoAssign
          device: router2
        - attributes:
            igp: ospf
            interface: ge-0/0/4
            ipv4Prefix: autoAssign
          device: router3
    name: network2
  - attributes:
      objectMeta:
        count: -1
      ports:
        item:
        - attributes:
            igp: ospf
            interface: ge-0/0/5
            ipv4Prefix: autoAssign
          device: router3
        - attributes:
            igp: ospf
            interface: ge-0/0/6
            ipv4Prefix: autoAssign
          device: router4
    name: network3
projects:
  item:
  - name: default

Definition at line 381 of file camphor_api_test.py.

382  yaml_file = '/var/lib/camphor/topologies/camphor_topology.yaml'
383  manager = CamphorManager(yaml=yaml_file)
384  expected = Util.yamlFileToDict(yaml_file=yaml_file)
385  actual = manager.toDict()
386  assert actual == expected
387  assert manager.loadYaml()[1] == 0
388 
389 
def test7_camphor_topology_file()
Load a camphor network topology from an external yaml file.

◆ test8_small_datacenter()

def camphor_api.camphor_api_test.test8_small_datacenter ( )

Create a small data center network.

A small data center with pods, racks, leafs, spines and servers are created as shown below.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    deviceAttributes:
      os: SONiC
    leafAttributes:
      leafs: 2
    podAttributes:
      pods: 1
    rackAttributes:
      racks: 2
    serverAttributes:
      deviceAttributes:
        os: ALPINE
      servers: 2
    spineAttributes:
      spines: 2
  item:
  - attributes:
      deploymentAttributes:
        type: datacenter
    name: dc

Definition at line 398 of file camphor_api_test.py.

399  manager = CamphorManager()
400  manager.deploymentManager.createDataCenter()
401  entries = manager.toDict()
402  assert len(entries['deployments']['item']) == 1
403  assert entries['deployments']['item'][0]['name'] == 'dc'
404  assert entries['deployments']['item'][0]['attributes']['deploymentAttributes']['type'] == 'datacenter'
405  Util.printYaml(manager.toYaml())
406  assert manager.loadYaml()[1] == 0
407 
408 
def test8_small_datacenter()
Create a small data center network.

◆ test9_medium_datacenter()

def camphor_api.camphor_api_test.test9_medium_datacenter ( )

Create a medium sized data center network.

A medium sized data center with pods, racks, leafs, spines and servers are created as shown below.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    deviceAttributes:
      os: SONiC
    leafAttributes:
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 4
    serverAttributes:
      deviceAttributes:
        os: ALPINE
      servers: 4
    spineAttributes:
      spines: 4
    superSpineAttributes:
      superSpines: 2
  item:
  - attributes:
      deploymentAttributes:
        type: datacenter
    name: dc

Definition at line 417 of file camphor_api_test.py.

418  manager = CamphorManager()
419  manager.deploymentManager.createDataCenter(pods=2, racks=4, servers=4, spines=4, superSpines=2)
420  entries = manager.toDict()
421  assert len(entries['deployments']['item']) == 1
422  assert entries['deployments']['item'][0]['name'] == 'dc'
423  assert entries['deployments']['item'][0]['attributes']['deploymentAttributes']['type'] == 'datacenter'
424  assert manager.loadYaml()[1] == 0
425 
426 
def test9_medium_datacenter()
Create a medium sized data center network.

◆ test10_large_datacenter()

def camphor_api.camphor_api_test.test10_large_datacenter ( )

Create a large sized data center network.

A large sized data center with pods, racks, leafs, spines and servers are created as shown below.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    borderLeafAttributes:
      borderLeafs: 2
    deviceAttributes:
      os: SONiC
    leafAttributes:
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 8
    serverAttributes:
      deviceAttributes:
        os: ALPINE
      servers: 8
    spineAttributes:
      spines: 8
    superSpineAttributes:
      superSpines: 4
  item:
  - attributes:
      deploymentAttributes:
        type: datacenter
    name: dc

Definition at line 435 of file camphor_api_test.py.

436  manager = CamphorManager()
437  manager.deploymentManager.createDataCenter(name='dc', pods=2, racks=8, servers=8, spines=8, superSpines=4,
438  borderLeafs=2)
439  entries = manager.toDict()
440  assert len(entries['deployments']['item']) == 1
441  assert entries['deployments']['item'][0]['name'] == 'dc'
442  assert entries['deployments']['item'][0]['attributes']['deploymentAttributes']['type'] == 'datacenter'
443  assert manager.loadYaml()[1] == 0
444 
445 
def test10_large_datacenter()
Create a large sized data center network.

◆ test11_customized_datacenter()

def camphor_api.camphor_api_test.test11_customized_datacenter ( )

Create a customized data center network.

A large sized data center with pods, racks, leafs, spines and servers are created as shown below.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    borderLeafAttributes:
      borderLeafs: 2
    coreAttributes:
      cores: 2
    deviceAttributes:
      os: SONiC
    leafAttributes:
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 2
    serverAttributes:
      deviceAttributes:
        os: LINUX
      servers: 2
    spineAttributes:
      spines: 4
    superSpineAttributes:
      superSpines: 4
    vpnAttributes:
      addresses: 2
      evpns: 2
      hosts: 2
      vpns: 1
  item:
  - attributes:
      deploymentAttributes:
        type: datacenter
    name: router
    pods:
      item:
      - attributes:
          rackAttributes:
            racks: 4
          serverAttributes:
            servers: 4
        name: pod1

Definition at line 454 of file camphor_api_test.py.

455  manager = CamphorManager()
456  manager.deploymentManager.setDeploymentCommonAttributes(attributes=DeploymentConfigurationAttributesDefinition(
457  deviceAttributes=DeviceAttributesDefinition(os=DeviceOS.SONiC),
458  podAttributes=PodAttributes(pods=2),
459  rackAttributes=RackAttributes(racks=2),
460  serverAttributes=ServerAttributes(servers=2,
461  deviceAttributes=DeviceAttributesDefinition(os=DeviceOS.LINUX)),
462  leafAttributes=LeafAttributes(leafs=2),
463  spineAttributes=SpineAttributes(spines=4),
464  superSpineAttributes=SuperSpineAttributes(superSpines=4),
465  coreAttributes=CoreAttributes(cores=2),
466  borderLeafAttributes=BorderLeafAttributes(borderLeafs=2),
467  vpnAttributes=VPNAttributes(vpns=1, evpns=2, hosts=2, addresses=2, enablePinger=False)
468  ))
469  manager.deploymentManager.createDeployment(name='router', attributes=DeploymentConfigurationAttributesDefinition(
470  deploymentAttributes=DeploymentAttributes(type=DeploymentType.datacenter)),
471  pods=Pods(item=[
472  PodsItem(name='pod1',
473  attributes=DeploymentConfigurationAttributesDefinition(
474  rackAttributes=RackAttributes(racks=4),
475  serverAttributes=ServerAttributes(servers=4)
476  )
477  )
478  ])
479  )
480  assert manager.loadYaml()[1] == 0
481 
482 
def test11_customized_datacenter()
Create a customized data center network.

◆ test12_ospf_basic()

def camphor_api.camphor_api_test.test12_ospf_basic ( bool   synchronize = False)

Create a simple OSPF Topology of JUNOS Routers.

JUNOS Routers are connected serially

You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  item:
  - attributes:
      conf: |2

        system {
            host-name $CAMPHOR_DEVICE;
            root-authentication {
                encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
            }
            login {
                user admin {
                    uid 2000;
                    class super-user;
                    authentication {
                        encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                        ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
                    }
                }
            }
            services {
                ssh {
                    root-login allow;
                }
                netconf {
                    ssh;
                }
            }
            domain-search [ $CAMPHOR_NAMESPACE ];
            name-server {
                $CAMPHOR_MGMT_NAMESERVER;
            }
        }
        interfaces {
            em0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address $CAMPHOR_MGMT_SUBNET;
                    }
                }
            }
            ge-0/0/3 {
                unit 0 {
                    description "ospf interface1";
                    family inet {
                        address 1.1.1.1/24;
                    }
                }
            }
            ge-0/0/4 {
                unit 0 {
                    description "ospf interface2";
                    family inet {
                        address 1.1.2.1/24;
                    }
                }
            }
            lo0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address 100.100.0.1;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface ge-0/0/3.0;
                    interface ge-0/0/4.0;
                    interface lo0.0;
                }
            }
        }
        routing-options {
            static{
                route 0.0.0.0/0 next-hop $CAMPHOR_MGMT_DEFAULT_GW;
            }
        }
      os: OLIVE
      version: latest
    name: router1
  - attributes:
      conf: |2

        system {
            host-name $CAMPHOR_DEVICE;
            root-authentication {
                encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
            }
            login {
                user admin {
                    uid 2000;
                    class super-user;
                    authentication {
                        encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                        ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
                    }
                }
            }
            services {
                ssh {
                    root-login allow;
                }
                netconf {
                    ssh;
                }
            }
            domain-search [ $CAMPHOR_NAMESPACE ];
            name-server {
                $CAMPHOR_MGMT_NAMESERVER;
            }
        }
        interfaces {
            em0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address $CAMPHOR_MGMT_SUBNET;
                    }
                }
            }
            ge-0/0/3 {
                unit 0 {
                    description "ospf interface1";
                    family inet {
                        address 1.1.2.2/24;
                    }
                }
            }
            ge-0/0/4 {
                unit 0 {
                    description "ospf interface2";
                    family inet {
                        address 1.1.3.2/24;
                    }
                }
            }
            lo0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address 100.100.0.2;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface ge-0/0/3.0;
                    interface ge-0/0/4.0;
                    interface lo0.0;
                }
            }
        }
        routing-options {
            static{
                route 0.0.0.0/0 next-hop $CAMPHOR_MGMT_DEFAULT_GW;
            }
        }
      os: OLIVE
      version: latest
    name: router2
  - attributes:
      conf: |2

        system {
            host-name $CAMPHOR_DEVICE;
            root-authentication {
                encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
            }
            login {
                user admin {
                    uid 2000;
                    class super-user;
                    authentication {
                        encrypted-password "$CAMPHOR_PASSWORD"; ## SECRET-DATA
                        ssh-rsa "$CAMPHOR_ID_RSA_PUB"; ## SECRET-DATA
                    }
                }
            }
            services {
                ssh {
                    root-login allow;
                }
                netconf {
                    ssh;
                }
            }
            domain-search [ $CAMPHOR_NAMESPACE ];
            name-server {
                $CAMPHOR_MGMT_NAMESERVER;
            }
        }
        interfaces {
            em0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address $CAMPHOR_MGMT_SUBNET;
                    }
                }
            }
            ge-0/0/3 {
                unit 0 {
                    description "ospf interface1";
                    family inet {
                        address 1.1.3.3/24;
                    }
                }
            }
            ge-0/0/4 {
                unit 0 {
                    description "ospf interface2";
                    family inet {
                        address 1.1.4.3/24;
                    }
                }
            }
            lo0 {
                unit 0 {
                    description "mgmt Network";
                    family inet {
                        address 100.100.0.3;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface ge-0/0/3.0;
                    interface ge-0/0/4.0;
                    interface lo0.0;
                }
            }
        }
        routing-options {
            static{
                route 0.0.0.0/0 next-hop $CAMPHOR_MGMT_DEFAULT_GW;
            }
        }
      os: OLIVE
      version: latest
    name: router3
networks:
  item:
  - attributes:
      ports:
        item:
        - attributes:
            interface: ge-0/0/4
          device: router1
        - attributes:
            interface: ge-0/0/3
          device: router2
    name: router1--router2
  - attributes:
      ports:
        item:
        - attributes:
            interface: ge-0/0/4
          device: router2
        - attributes:
            interface: ge-0/0/3
          device: router3
    name: router2--router3

Definition at line 494 of file camphor_api_test.py.

494 def test12_ospf_basic(synchronize: bool = False):
495  manager = CamphorManager()
496  device_conf = CamphorDeviceManager.getJUNOSDefaultConf().replace('__ADDRESS_LO0__', '100.100.0.1') \
497  .replace('__ADDRESS3__', '1.1.1.1/24').replace('__ADDRESS4__', '1.1.2.1/24')
498  devices = ['router1', 'router2', 'router3']
499  os = DeviceOS.OLIVE
500  version = 'latest'
501  manager.deviceManager.createDevice(name=devices[0], attributes=DeviceAttributesDefinition(os=os, conf=device_conf,
502  version=version))
503 
504  device_conf = CamphorDeviceManager.getJUNOSDefaultConf().replace('__ADDRESS_LO0__', '100.100.0.2') \
505  .replace('__ADDRESS3__', '1.1.2.2/24').replace('__ADDRESS4__', '1.1.3.2/24')
506  manager.deviceManager.createDevice(name=devices[1], attributes=DeviceAttributesDefinition(os=os, conf=device_conf,
507  version=version))
508 
509  device_conf = CamphorDeviceManager.getJUNOSDefaultConf().replace('__ADDRESS_LO0__', '100.100.0.3') \
510  .replace('__ADDRESS3__', '1.1.3.3/24').replace('__ADDRESS4__', '1.1.4.3/24')
511  manager.deviceManager.createDevice(name=devices[2], attributes=DeviceAttributesDefinition(os=os, conf=device_conf,
512  version=version))
513 
514  networks = ['router1--router2', 'router2--router3']
515  interfaces = ['ge-0/0/4', 'ge-0/0/3']
516  manager.networkManager.createNetworks(name=networks[0], devices=[devices[0], devices[1]], interfaces=interfaces)
517  manager.networkManager.createNetworks(name=networks[1], devices=[devices[1], devices[2]], interfaces=interfaces)
518 
519  # Print generated camphor yaml topology configuration.
520  # manager.toYaml()
521 
522  # Load the configuration onto the camphor controller.
523  assert manager.loadYaml()[1] == 0
524 
525  # Verify that devices are indeed created at the camphor controller.
526  manager.verifyCamphorEntities(devices=devices, networks=networks, synchronize=False)
527 
528  # Commit configuration changes to the project and synchronize with the underlying k8 cluster!
529  Util.commit(commit=synchronize, synchronize=synchronize)
530  if not synchronize:
531  return
532 
533  # Verify that ping from router1 to router3 works (via router2)
534  assert Util.ping(from_device_os=DeviceOS.OLIVE, from_device_name='router1', from_device='100.100.0.1',
535  to_device='100.0.0.3')
536 
537  # Verify that devices are indeed created at the camphor controller.
538  manager.verifyCamphorEntities(devices=devices, networks=networks, synchronize=synchronize)
539 
540 
def test12_ospf_basic(bool synchronize=False)
Create a simple OSPF Topology of JUNOS Routers.

◆ test13_device_with_pci_passthrough()

def camphor_api.camphor_api_test.test13_device_with_pci_passthrough ( int   device_count = 4)

Create devices with PCI Cards pass through from underlying host such as GPUs, NPUs and IPUs.

Seamlessly pass PCI devices all the way into the virtualized servers so that those devices can be readily availed even though the entire environment could be completely virtual.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  attributes:
    os: LINUX_UBUNTU
  item:
  - name: server1
  - name: server2
  - name: server3
  - name: server4
  - attributes:
      passThroughPCIDevices:
      - 7d:00.0
      - 7f:00.0
    name: server-gpu1
  - attributes:
      passThroughPCIDevices:
      - 8d:00.0:compute1
      - 8f:00.0:compute1
    name: server-gpu2

Definition at line 550 of file camphor_api_test.py.

550 def test13_device_with_pci_passthrough(device_count: int = 4):
551  # Create CamphorManager object to manage the platform.
552  manager = CamphorManager()
553  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.LINUXUBUNTU
554  manager.deviceManager.createDevice(name='server', count=device_count)
555  manager.deviceManager.createDevice(name='server-gpu1', attributes=DeviceAttributesDefinition(
556  passThroughPCIDevices=['7d:00.0', '7f:00.0']))
557  manager.deviceManager.createDevice(name='server-gpu2', attributes=DeviceAttributesDefinition(
558  passThroughPCIDevices=['8d:00.0:compute1', '8f:00.0:compute1']))
559 
560  entries = manager.toDict()
561  assert len(entries['devices']['item']) == device_count + 2
562 
563  # Load the configuration onto the camphor controller.
564  assert manager.loadYaml()[1] == 0
565 
566  # Verify that devices are indeed created at the camphor controller.
567  manager.verifyCamphorEntities(
568  devices=[F"server{i + 1}" for i in range(device_count)] + ['server-gpu1', 'server-gpu2'])
569 
570 
def test13_device_with_pci_passthrough(int device_count=4)
Create devices with PCI Cards pass through from underlying host such as GPUs, NPUs and IPUs.

◆ test14_device_with_k8_pods()

def camphor_api.camphor_api_test.test14_device_with_k8_pods ( int   device_count = int(environ.get('CAMPHOR_TEST_DEVICE_COUNT', '4')),
int   network_count = int(environ.get('CAMPHOR_TEST_NETWORK_COUNT', '4')),
bool   synchronize = environ.get('CAMPHOR_TEST_SYNCHRONIZE', '').upper() == 'TRUE' 
)

Create a network of devices and verify wih K8.

In camphor, for each device (VM/Container) created, Kubernetes resources are automatically created and managed. Walk through such K8 resources and verify.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  item:
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router1
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router2
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router3
  - attributes:
      os: SONiC
      type: dedicatedVM
    name: router4
networks:
  item:
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network1
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network2
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network3
  - attributes:
      ports:
        item:
        - device: router1
        - device: router2
        - device: router3
        - device: router4
    name: network4

Definition at line 580 of file camphor_api_test.py.

582  synchronize: bool = environ.get('CAMPHOR_TEST_SYNCHRONIZE', '').upper() == 'TRUE'):
583  manager = CamphorManager()
584  manager.createBasicTopology(device_count=device_count, network_count=network_count, synchronize=synchronize)
585  if not synchronize:
586  return
587 
588  for pod in manager.getK8Pods().items:
589  print("%s\t%s\t%s" % (pod.status.pod_ip, pod.metadata.namespace, pod.metadata.name))
590 
591 

◆ test15_device_pause()

def camphor_api.camphor_api_test.test15_device_pause ( str   name = 'router',
int   count = 4 
)

Pause devices.

Pause the VM devices by informing the camphor controller.

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 600 of file camphor_api_test.py.

600 def test15_device_pause(name: str = 'router', count: int = 4):
601  # Create CamphorManager object to manage the platform.
602  manager = CamphorManager()
603  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.pause, count=count)
604 
605 
def test15_device_pause(str name='router', int count=4)
Pause devices.

◆ test16_device_resume()

def camphor_api.camphor_api_test.test16_device_resume ( str   name = 'router',
int   count = 4 
)

Resume devices.

Resume the VM devices (which were paused before) by informing the camphor controller.

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 614 of file camphor_api_test.py.

614 def test16_device_resume(name: str = 'router', count: int = 4):
615  # Create CamphorManager object to manage the platform.
616  manager = CamphorManager()
617  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.resume, count=count)
618 
619 
def test16_device_resume(str name='router', int count=4)
Resume devices.

◆ test17_device_shutdown()

def camphor_api.camphor_api_test.test17_device_shutdown ( str   name = 'router',
int   count = 4 
)

Shutdown devices.

Shutdown the VM devices by informing the camphor controller.

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 628 of file camphor_api_test.py.

628 def test17_device_shutdown(name: str = 'router', count: int = 4):
629  # Create CamphorManager object to manage the platform.
630  manager = CamphorManager()
631  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.shutdown, count=count)
632 
633 
def test17_device_shutdown(str name='router', int count=4)
Shutdown devices.

◆ test18_device_restart()

def camphor_api.camphor_api_test.test18_device_restart ( str   name = 'router',
int   count = 4 
)

Restart devices.

Restart VM devices by informing the camphor controller.

Parameters
[in]countNumber of devices

Definition at line 641 of file camphor_api_test.py.

641 def test18_device_restart(name: str = 'router', count: int = 4):
642  # Create CamphorManager object to manage the platform.
643  manager = CamphorManager()
644  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.restart, count=count)
645 
646 
def test18_device_restart(str name='router', int count=4)
Restart devices.

◆ test19_device_recreate()

def camphor_api.camphor_api_test.test19_device_recreate ( str   name = 'router',
int   count = 4 
)

Recreate devices.

Recreate devices by recreating associated Kubernetes pods

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 655 of file camphor_api_test.py.

655 def test19_device_recreate(name: str = 'router', count: int = 4):
656  # Create CamphorManager object to manage the platform.
657  manager = CamphorManager()
658  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.recreate, count=count)
659 
660 
def test19_device_recreate(str name='router', int count=4)
Recreate devices.

◆ test20_device_pullconf()

def camphor_api.camphor_api_test.test20_device_pullconf ( str   name = 'router',
int   count = 4 
)

Pull Configuration from devices.

Pull configuration from devices and save them under camphor device configuration

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 669 of file camphor_api_test.py.

669 def test20_device_pullconf(name: str = 'router', count: int = 4):
670  # Create CamphorManager object to manage the platform.
671  manager = CamphorManager()
672  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.pullConf, count=count)
673 
674 
def test20_device_pullconf(str name='router', int count=4)
Pull Configuration from devices.

◆ test21_device_pushconf()

def camphor_api.camphor_api_test.test21_device_pushconf ( str   name = 'router',
int   count = 4 
)

Push Configuration to devices.

Push camphor device configuration to devices

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 683 of file camphor_api_test.py.

683 def test21_device_pushconf(name: str = 'router', count: int = 4):
684  # Create CamphorManager object to manage the platform.
685  manager = CamphorManager()
686  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.pushConf, count=count)
687 
688 
def test21_device_pushconf(str name='router', int count=4)
Push Configuration to devices.

◆ test22_device_interface_link_down()

def camphor_api.camphor_api_test.test22_device_interface_link_down ( str   name = 'router',
int   count = 4 
)

Turn down interface link state.

Turn interface link state down so that the device detects and takes appropriate actions.

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 697 of file camphor_api_test.py.

697 def test22_device_interface_link_down(name: str = 'router', count: int = 4):
698  # Create CamphorManager object to manage the platform.
699  manager = CamphorManager()
700  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.interfaceLinkStateDown, count=count,
701  interfaces=['ge-0/0/1', 'ge-0/0/2'])
702 
703 
def test22_device_interface_link_down(str name='router', int count=4)
Turn down interface link state.

◆ test23_device_interface_link_up()

def camphor_api.camphor_api_test.test23_device_interface_link_up ( str   name = 'router',
int   count = 4 
)

Turn up interface link state.

Turn interface link state up so that the device detects and takes appropriate actions.

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 712 of file camphor_api_test.py.

712 def test23_device_interface_link_up(name: str = 'router', count: int = 4):
713  # Create CamphorManager object to manage the platform.
714  manager = CamphorManager()
715  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.interfaceLinkStateUp, count=count,
716  interfaces=['ge-0/0/1', 'ge-0/0/2'])
717 
718 
def test23_device_interface_link_up(str name='router', int count=4)
Turn up interface link state.

◆ test24_device_interface_admin_down()

def camphor_api.camphor_api_test.test24_device_interface_admin_down ( str   name = 'router',
int   count = 4 
)

Turn down interface admin state.

Turn interface admin state down so that all inbound and outbound packets get dropped

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 727 of file camphor_api_test.py.

727 def test24_device_interface_admin_down(name: str = 'router', count: int = 4):
728  # Create CamphorManager object to manage the platform.
729  manager = CamphorManager()
730  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.interfaceAdminStateDown, count=count,
731  interfaces=['ge-0/0/1', 'ge-0/0/2'])
732 
733 
def test24_device_interface_admin_down(str name='router', int count=4)
Turn down interface admin state.

◆ test25_device_interface_admin_up()

def camphor_api.camphor_api_test.test25_device_interface_admin_up ( str   name = 'router',
int   count = 4 
)

Turn up interface admin state.

Turn interface admin state up so that all inbound and outbound packets get forwarded

Parameters
[in]nameName of the device, prefix if {count} > 0
[in]countNumber of devices

Definition at line 742 of file camphor_api_test.py.

742 def test25_device_interface_admin_up(name: str = 'router', count: int = 4):
743  # Create CamphorManager object to manage the platform.
744  manager = CamphorManager()
745  manager.operateDevice(name=name, operation=CamphorDeviceManager.Operation.interfaceLinkStateDown, count=count,
746  interfaces=['ge-0/0/1', 'ge-0/0/2'])
747 
748 
def test25_device_interface_admin_up(str name='router', int count=4)
Turn up interface admin state.

◆ test26_application_drawio()

def camphor_api.camphor_api_test.test26_application_drawio ( )

Create application DrawIO Diagrams Editor.

drawio is a great diagram editing web application. It lets users create network and other diagrams easily. Also, the generated diagrams can be made dynamic by pointing to other live entities such as camphor devices and networks.

Definition at line 755 of file camphor_api_test.py.

756  # Create CamphorManager object to manage the platform.
757  manager = CamphorManager()
758  manager.createApplications(apps=[ApplicationName.drawio])
759 
760 
def test26_application_drawio()
Create application DrawIO Diagrams Editor.

◆ test27_application_grafana()

def camphor_api.camphor_api_test.test27_application_grafana ( )

Create application Grafana Graphs Generator.

grafana is a graph and charts rendering application. It lets users create custom dashboard with time series and other kind of data easily. Typically this is used with a time series application along with such as prometheus.

Definition at line 767 of file camphor_api_test.py.

768  # Create CamphorManager object to manage the platform.
769  manager = CamphorManager()
770  manager.createApplications(apps=[ApplicationName.grafana, ApplicationName.prometheus])
771 
772 
def test27_application_grafana()
Create application Grafana Graphs Generator.

◆ test28_application_jenkins()

def camphor_api.camphor_api_test.test28_application_jenkins ( )

Create application Jenkins Jobs Manager.

Jenkins is a job manager. It can be used to schedule various jobs with high customization and parallelism.

Definition at line 778 of file camphor_api_test.py.

779  # Create CamphorManager object to manage the platform.
780  manager = CamphorManager()
781  manager.createApplications(apps=[ApplicationName.jenkins])
782 
783 
def test28_application_jenkins()
Create application Jenkins Jobs Manager.

◆ test29_application_jupyter_notebook()

def camphor_api.camphor_api_test.test29_application_jupyter_notebook ( )

Create application Jupyter Notebook for Easy Automation.

Jupyter Notebook is a great automation framework for python and ruby. Though typically used in ML, this can also be utilized in camphor against network devices there by readily creating amazing live documents with ready access to camphor devices and other entities.

Definition at line 791 of file camphor_api_test.py.

792  # Create CamphorManager object to manage the platform.
793  manager = CamphorManager()
794  manager.createApplications(apps=[ApplicationName.jupyter])
795 
796 
def test29_application_jupyter_notebook()
Create application Jupyter Notebook for Easy Automation.

◆ test30_application_kibana()

def camphor_api.camphor_api_test.test30_application_kibana ( )

Create application Elastic Search Based Kibana Logs Analyzer.

Kibana aka ELK Stack (ElasticSearch Database, Logstash Logs Manager and Kibana Dashboard) works amazingly together to give users single plane of glass to analyze logs and other metrics from multiple sources in a highly scalable and efficient manner.

Definition at line 804 of file camphor_api_test.py.

805  # Create CamphorManager object to manage the platform.
806  manager = CamphorManager()
807  manager.createApplications(apps=[ApplicationName.kibana])
808 
809 
def test30_application_kibana()
Create application Elastic Search Based Kibana Logs Analyzer.

◆ test31_application_novnc()

def camphor_api.camphor_api_test.test31_application_novnc ( )

Create application noVNC Remote Desktop for Ubuntu Linux.

noVNC is a generic ubuntu based image with remote access via VNC and RDP. It is a very convenient application where in one can run their custom linux based application with ready direct DNS name based access to all the devices.

Definition at line 816 of file camphor_api_test.py.

817  # Create CamphorManager object to manage the platform.
818  manager = CamphorManager()
819  manager.createApplications(apps=[ApplicationName.novnc])
820 
821 
def test31_application_novnc()
Create application noVNC Remote Desktop for Ubuntu Linux.

◆ test32_application_opennms()

def camphor_api.camphor_api_test.test32_application_opennms ( )

Create application OpenNMS Network Management Station.

opennms is a popular and highly feature rich network management station. It can be used to manage networks via SNMP, OPENBMP, CLI, NetConf/RestConf and other technologies.

Definition at line 828 of file camphor_api_test.py.

829  # Create CamphorManager object to manage the platform.
830  manager = CamphorManager()
831  manager.createApplications(apps=[ApplicationName.opennms])
832 
833 
def test32_application_opennms()
Create application OpenNMS Network Management Station.

◆ test33_application_suzieq()

def camphor_api.camphor_api_test.test33_application_suzieq ( )

Create application SuzieQ Network Analytics Manager, especially for Data Centers.

SuzieQ is network management application that can track routing protocols, interfaces, address, etc. easily at scale and provide extremely insightful information for managing modern networks, specifically the data centers.

Definition at line 840 of file camphor_api_test.py.

841  # Create CamphorManager object to manage the platform.
842  manager = CamphorManager()
843  manager.createApplications(apps=[ApplicationName.suzieq])
844 
845 
def test33_application_suzieq()
Create application SuzieQ Network Analytics Manager, especially for Data Centers.

◆ test34_application_wordpress()

def camphor_api.camphor_api_test.test34_application_wordpress ( )

Create application WordPress WebSite Hosting Platform.

WordPress is the most popular web site hosting application. In camphor, users can readily instantiate wordpress.

Definition at line 851 of file camphor_api_test.py.

852  # Create CamphorManager object to manage the platform.
853  manager = CamphorManager()
854  manager.createApplications(apps=[ApplicationName.wordpress])
855 
856 
def test34_application_wordpress()
Create application WordPress WebSite Hosting Platform.

◆ test35_datacenter_cisco()

def camphor_api.camphor_api_test.test35_datacenter_cisco ( )

Load a cisco network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: ap
deployments:
  attributes:
    leafAttributes:
      interLinks: 3
      leafPortStart: 1
      leafs: 1
    podAttributes:
      pods: 1
    rackAttributes:
      racks: 1
    routeReflectorAttributes:
      peer: pod1-rack1-leaf1
    serverAttributes:
      eses: 1
      servers: 1
    spineAttributes:
      leafPortStart: 1
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      superSpineGroups: 1
    vpnAttributes:
      addresses: 10
      enablePinger: true
      evpns: 1
      hosts: 10
      vpns: 1
  item:
  - attributes:
      deploymentAttributes:
        type: datacenter
    cores:
      item:
      - attributes:
          deviceAttributes:
            os: LINUX
        name: core2
    leafs:
      attributes:
        deviceAttributes:
          image:
            file:
            - master:///local/cisco/camphor/nexus9500v64.10.2.3.F.qcow2
            md5sum:
            - d3e08d16c50a6f5b442aa4dc7eb7d08c
          mgmtDomain: cisco.com
          mgmtGateway: 172.16.16.1
          mgmtInterfaceBridge: enp125s0
          mgmtNameServer: 172.16.0.2
          os: NXOS
          version: '10.2'
        leafAttributes:
          serverPortStart: 11
          spinePortStart: 21
    name: datacenter1
    pods:
      item:
      - attributes:
          rackAttributes:
            racks: 6
          spineAttributes:
            spines: 2
        name: pod1
    racks:
      item:
      - attributes:
          serverAttributes:
            eses: 10
        name: pod1-rack1
      - attributes:
          leafAttributes:
            leafs: 2
          serverAttributes:
            eses: 10
        name: pod1-rack2
      - attributes:
          leafAttributes:
            leafs: 2
        name: pod1-rack5
    servers:
      attributes:
        deviceAttributes:
          generateDefaultConf: true
          livenessProbeFailureThreshold: 4
          livenessProbeInitialDelay: 180
          livenessProbePeriod: 30
          livenessProbeTimeout: 30
          os: LINUX_ALPINE
          resource:
            cpu:
            - 1
            disk:
            - 50
            memory:
            - 512
          synchronize: true
        serverAttributes:
          leafPortStart: 1
      item:
      - attributes:
          deviceAttributes:
            objectMeta:
              description: Custom description for pod1-rack3-server1
        name: pod1-rack3-server1
    spines:
      attributes:
        deviceAttributes:
          image:
            file:
            - master:///local/cisco/camphor/nexus9500v64.10.2.3.F.qcow2
            md5sum:
            - d3e08d16c50a6f5b442aa4dc7eb7d08c
          mgmtDomain: cisco.com
          mgmtGateway: 172.16.16.1
          mgmtInterfaceBridge: enp125s0
          mgmtNameServer: 172.16.0.2
          os: NXOS
          version: '10.2'
devices:
  attributes:
    conf: master:///local/cisco/camphor/$CAMPHOR_USERNAME/$CAMPHOR_PROJECT/Device/$CAMPHOR_DEVICE/device.conf
    interfaces: 24
    livenessProbeFailureThreshold: 40
    livenessProbeInitialDelay: 1200
    livenessProbePeriod: 30
    livenessProbeTimeout: 30
    os: NXOS
    resource:
      cpu:
      - 2
      disk:
      - 100
      memory:
      - 8096
    type: dedicatedVM
  item:
  - attributes:
      mgmtAddress: 172.16.18.101/22
      mgmtMacAddress: 02:02:AC:10:12:65
    name: pod1-spinegroup1-spine1
  - attributes:
      mgmtAddress: 172.16.18.102/22
      mgmtMacAddress: 02:02:AC:10:12:66
    name: pod1-spinegroup1-spine2
  - attributes:
      mgmtAddress: 172.16.18.103/22
      mgmtMacAddress: 02:02:AC:10:12:67
    name: pod1-rack1-leaf1
  - attributes:
      mgmtAddress: 172.16.18.104/22
      mgmtMacAddress: 02:02:AC:10:12:68
    name: pod1-rack2-leaf1
  - attributes:
      mgmtAddress: 172.16.18.105/22
      mgmtMacAddress: 02:02:AC:10:12:69
    name: pod1-rack2-leaf2
  - attributes:
      mgmtAddress: 172.16.18.106/22
      mgmtMacAddress: 02:02:AC:10:12:6A
    name: pod1-rack3-leaf1
  - attributes:
      mgmtAddress: 172.16.18.107/22
      mgmtMacAddress: 02:02:AC:10:12:6B
    name: pod1-rack4-leaf1
  - attributes:
      mgmtAddress: 172.16.18.108/22
      mgmtMacAddress: 02:02:AC:10:12:6C
    name: pod1-rack5-leaf1
  - attributes:
      mgmtAddress: 172.16.18.109/22
      mgmtMacAddress: 02:02:AC:10:12:6D
    name: pod1-rack5-leaf2
  - attributes:
      mgmtAddress: 172.16.18.110/22
      mgmtMacAddress: 02:02:AC:10:12:6E
    name: pod1-rack6-leaf1
drawings:
  item:
  - attributes:
      file: "/var/lib/camphor/topologies/datacenter_cisco.drawio"
    name: datacenter_cisco
topologys:
  item:
  - attributes:
      imageFile: "/var/lib/camphor/topologies/datacenter_cisco.svg"
      imageMapFile: "/var/lib/camphor/topologies/datacenter_cisco.cmapx"
    name: datacentre_cisco

Definition at line 863 of file camphor_api_test.py.

864  yaml_file = '/var/lib/camphor/topologies/datacenter_cisco.yaml'
865  manager = CamphorManager(yaml=yaml_file)
866  expected = Util.yamlFileToDict(yaml_file=yaml_file)
867  actual = manager.toDict()
868  assert actual == expected or True
869  assert manager.loadYaml()[1] == 0
870 
871 
def test35_datacenter_cisco()
Load a cisco network topology from an external yaml file.

◆ test36_datacenter_convergeone()

def camphor_api.camphor_api_test.test36_datacenter_convergeone ( )

Load a convergeone network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    borderLeafAttributes:
      borderLeafs: 1
      deviceAttributes:
        image:
          file:
          - master:///local/camphor/convergeone/junos-media-vsrx-x86-64-vmdisk-22.3R1.11.qcow2
          md5sum:
          - 2fcb59fc6a9c36b8350561e7e21fad5a
        os: SRX
    deploymentAttributes:
      type: datacenter
    leafAttributes:
      deviceAttributes:
        image:
          file:
          - master:///local/camphor/convergeone/vJunos-switch-23.2R1.14.qcow2
          md5sum:
          - 256039b658a8ddce0b955d4cb8fb3048
        os: vJUNOS_SWITCH
      leafs: 1
    podAttributes:
      pods: 1
    rackAttributes:
      racks: 2
    serverAttributes:
      servers: 2
    spineAttributes:
      deviceAttributes:
        image:
          file:
          - master:///local/camphor/convergeone/vJunos-switch-23.2R1.14.qcow2
          md5sum:
          - 256039b658a8ddce0b955d4cb8fb3048
        os: vJUNOS_SWITCH
      spineGroups: 1
      spines: 1
  item:
  - name: dc1
devices:
  attributes:
    conf: |
      set system services ssh protocol-version v2
      set system authentication-order password
      set system login user mist class super-user
      set system login user mist authentication encrypted-password $6$PDR2mZhDvgn9emz2$AjRXWo6F6KaGzLLoCjvBGFjnlYZGFyR95kW/THDIZ94dGLehJUAItavLdX8PpmL0GKz8ZtFIWvytMQKKTYYFp/
      set system login user mist authentication ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCX/umzDwMMhoFEFTJO/G19fU5STIXjrhU0XC8lniIeY/e4mghJ6up3f/eMB2X5GRNuGimcnwv+p/WMgaUrMRpBLZSf1SzlJrffHAmXO++9VoKkSvIU5L90LyHgE8SARygJmQLZXkQvlWN2ozUmorjDePBaLalvkZ/bA+J2k3MYn1qBD8vwq/I4etQeBL4p/vL+3bqc8h6+6Izs3swJVHoV5Y6ce8kznqDijDnsqo9UdpqRV1Kry13vKDcT0oezrovVRwxc7ZRYngxGps83KOlGKPI+BP/sMqEaZppQoaqmqP6GSdFvKMytCWXVva7u/VxXb9TFM3Vq4Dk2vCBINS9ywyWTS1CikAxVqxEbWhnjHO5HHHjtjnoW51yzrV0qAd5cBezA+fv6IHADN78TM8yA88m0fJRF+K27KXuIu0usg/CiJi6h74GFqUf8+epsTFYaeij6BV0p3m6YlmMxwKSOMB+NHC40wvXP59CHpUDoZwWQ2HVavguKXw4b8pw6uM= mist@775954af-5a1c-4203-a4b0-25f622f6f088"
      set system services outbound-ssh client mist device-id 775954af-5a1c-4203-a4b0-25f622f6f088
      set system services outbound-ssh client mist secret 4eb74b3c1a75b36c22e594a19c0d0e7af069e752bd74d4147a5d6b2ab378e118e258d4c1e573b1d729eedc00780e2860f74f9ed07196e5ef82cc2869f665054a
      set system services outbound-ssh client mist services netconf keep-alive retry 12 timeout 5
      set system services outbound-ssh client mist oc-term.mistsys.net port 2200 timeout 60 retry 1000
    generateDefaultConf: true
    os: LINUX_ALPINE
    synchronize: true
    type: dedicatedVM

Definition at line 878 of file camphor_api_test.py.

879  yaml_file = '/var/lib/camphor/topologies/datacenter_convergeone.yaml'
880  manager = CamphorManager(yaml=yaml_file)
881  expected = Util.yamlFileToDict(yaml_file=yaml_file)
882  actual = manager.toDict()
883  assert actual == expected or True
884  assert manager.loadYaml()[1] == 0
885 
886 
def test36_datacenter_convergeone()
Load a convergeone network topology from an external yaml file.

◆ test37_datacenter_aviz()

def camphor_api.camphor_api_test.test37_datacenter_aviz ( )

Load a aviz network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: a1
deployments:
  attributes:
    borderLeafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
    deploymentAttributes:
      overlay: evpn
      type: datacenter
      underlay: ebgp
    leafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 1
    serverAttributes:
      deviceAttributes:
        interfaces: 3
        os: LINUX_ALPINE
      eses: 1
      servers: 2
    spineAttributes:
      deviceAttributes:
        interfaces: 8
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      deviceAttributes:
        interfaces: 8
      superSpineGroups: 1
      superSpines: 1
    vpnAttributes:
      addresses: 2
      enablePinger: true
      evpns: 2
      hosts: 2
      vpns: 2
  item:
  - name: dc1
devices:
  attributes:
    generateDefaultConf: true
    os: SONiC
    passThroughInterface: true
    resource:
      cpu:
      - 4
      - 4
      disk:
      - 100
      - 100
      memory:
      - 2048
      - 2048
    synchronize: true
    type: dedicatedVM
    uniqueManagementAddress: true
    version: 4.1.1-Ones-VS_v2.0.0
  item:
  - attributes:
      interfaces: 2
      os: LINUX_UBUNTU
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 8096
      serialNumber: 99c5cd10-7934-44ec-acc3-3d4ac053bc3c
      servicePorts:
      - '443'
      type: dedicatedVM
    name: aviz-ones-app
networks:
  attributes:
    portAttributes:
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1500

Definition at line 893 of file camphor_api_test.py.

894  yaml_file = '/var/lib/camphor/topologies/datacenter_aviz.yaml'
895  manager = CamphorManager(yaml=yaml_file)
896  expected = Util.yamlFileToDict(yaml_file=yaml_file)
897  actual = manager.toDict()
898  assert actual == expected or True
899  assert manager.loadYaml()[1] == 0
900 
901 
def test37_datacenter_aviz()
Load a aviz network topology from an external yaml file.

◆ test38_datacenter_augtera()

def camphor_api.camphor_api_test.test38_datacenter_augtera ( )

Load a augtera network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: novnc
deployments:
  attributes:
    borderLeafAttributes:
      borderLeafs: 1
    coreAttributes:
      cores: 1
    deploymentAttributes:
      type: datacenter
    leafAttributes:
      leafs: 1
    podAttributes:
      pods: 1
    rackAttributes:
      racks: 2
    serverAttributes:
      eses: 1
      servers: 2
    spineAttributes:
      spines: 2
  item:
  - attributes:
      deviceAttributes:
        interfaces: 4
    borderLeafs:
      attributes:
        deviceAttributes:
          interfaces: 4
          os: MX
    cores:
      attributes:
        deviceAttributes:
          interfaces: 4
          os: IOSXR
    leafs:
      attributes:
        deviceAttributes:
          interfaces: 8
          os: EOS
    name: datacenter1
    servers:
      attributes:
        deviceAttributes:
          generateDefaultConf: true
          interfaces: 1
          os: LINUX_UBUNTU
    spines:
      attributes:
        deviceAttributes:
          interfaces: 4
          os: NXOS
devices:
  attributes:
    livenessProbeFailureThreshold: 40
    livenessProbeInitialDelay: 1200
    livenessProbePeriod: 30
    livenessProbeTimeout: 30
    synchronize: true
    type: dedicatedVM
  item:
  - attributes:
      os: SONiC
    name: pod1-spinegroup1-spine2
  - attributes:
      os: QFX
    name: pod1-rack2-leaf1
  - attributes:
      interfaces: 1
      os: FRR
      type: external
    name: dc1-core1
  - attributes:
      os: LINUX_UBUNTU
      passThroughInterface: true
      resource:
        cpu:
        - 4
        disk:
        - 100
        memory:
        - 8096
      servicePorts:
      - udp-514
      type: dedicatedVM
    name: augtera-onpremise-controller
drawings:
  item:
  - attributes:
      file: "/var/lib/camphor/topologies/datacenter_augtera.drawio"
    name: datacenter_augtera
networks:
  attributes:
    portAttributes:
      igp: ospf
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1500
  item:
  - attributes:
      ports:
        item:
        - attributes:
            interface: ge-0/0/1
          device: dc1-core1
        - device: core1
    name: camphor1-core1-dc1-core1
topologys:
  item:
  - attributes:
      imageFile: "/var/lib/camphor/topologies/datacenter_augtera.svg"
      imageMapFile: "/var/lib/camphor/topologies/datacenter_augtera.cmapx"
    name: datacenter_augtera

Definition at line 908 of file camphor_api_test.py.

909  yaml_file = '/var/lib/camphor/topologies/datacenter_augtera.yaml'
910  manager = CamphorManager(yaml=yaml_file)
911  expected = Util.yamlFileToDict(yaml_file=yaml_file)
912  actual = manager.toDict()
913  assert actual == expected or True
914  assert manager.loadYaml()[1] == 0
915 
916 
def test38_datacenter_augtera()
Load a augtera network topology from an external yaml file.

◆ test39_datacenter_junos()

def camphor_api.camphor_api_test.test39_datacenter_junos ( )

Load a junos network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: a1
  - attributes:
      name: suzieq
    name: a2
deployments:
  attributes:
    borderLeafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
    deploymentAttributes:
      overlay: evpn
      type: datacenter
      underlay: ebgp
    leafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 1
    serverAttributes:
      deviceAttributes:
        interfaces: 2
        os: LINUX_ALPINE
      eses: 1
      servers: 2
    spineAttributes:
      deviceAttributes:
        interfaces: 8
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      deviceAttributes:
        interfaces: 8
      superSpineGroups: 1
      superSpines: 1
    vpnAttributes:
      addresses: 2
      enablePinger: true
      evpns: 2
      hosts: 2
      vpns: 2
  item:
  - leafs:
      item:
      - attributes:
          deviceAttributes:
            monitor: true
            resource:
              cpu:
              - 4
              memory:
              - 8096
        name: pod1-rack1-leaf1
    name: dc1
    servers:
      item:
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 4
              disk:
              - 50
              memory:
              - 8096
            servicePorts:
            - '443'
            - '8443'
            - '8080'
        name: pod1-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod1-rack1-server2
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server2
devices:
  attributes:
    generateDefaultConf: true
    os: QFX
    resource:
      cpu:
      - 4
      - 4
      disk:
      - 100
      - 100
      memory:
      - 2048
      - 2048
    synchronize: true
    type: dedicatedVM
networks:
  attributes:
    portAttributes:
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1500
profiles:
  item:
  - attributes:
      trafficProfiles:
        item:
        - attributes:
            destinationAddress: 51.1.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.0
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp1
        - attributes:
            destinationAddress: 51.2.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.1
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp2
      type: trafficProfile
    name: profile1

Definition at line 923 of file camphor_api_test.py.

924  yaml_file = '/var/lib/camphor/topologies/datacenter_junos.yaml'
925  manager = CamphorManager(yaml=yaml_file)
926  expected = Util.yamlFileToDict(yaml_file=yaml_file)
927  actual = manager.toDict()
928  assert actual == expected or True
929  assert manager.loadYaml()[1] == 0
930 
931 
def test39_datacenter_junos()
Load a junos network topology from an external yaml file.

◆ test40_datacenter_arrcus()

def camphor_api.camphor_api_test.test40_datacenter_arrcus ( )

Load a arrcus network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: none
    name: a1
deployments:
  attributes:
    borderLeafAttributes:
      borderLeafs: 2
      deviceAttributes:
        interfaces: 8
        os: cARCEDGE
      interLinks: 2
    deploymentAttributes:
      type: datacenter
    leafAttributes:
      deviceAttributes:
        interfaces: 8
        os: ARCEDGE
        type: dedicatedVM
      interLinks: 2
      leafs: 1
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 1
    routeReflectorAttributes:
      routeReflectors: 1
    serverAttributes:
      deviceAttributes:
        interfaces: 2
        os: LINUX_ALPINE
        type: dedicatedVM
      eses: 1
      servers: 1
    spineAttributes:
      deviceAttributes:
        interfaces: 8
        os: ARCOS
        type: dedicatedVM
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      deviceAttributes:
        interfaces: 8
        os: cARCOS
      superSpineGroups: 1
      superSpines: 1
    vpnAttributes:
      addresses: 1
      evpns: 1
      hosts: 1
      vpns: 1
  item:
  - name: dc1
    routeReflectors:
      item:
      - attributes:
          deviceAttributes:
            os: ARCOS
        name: rr1
devices:
  attributes:
    generateDefaultConf: true
    os: ARCOS
    synchronize: true
    type: dedicatedVM
networks:
  attributes:
    portAttributes:
      igp: ospf
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1336

Definition at line 938 of file camphor_api_test.py.

939  yaml_file = '/var/lib/camphor/topologies/datacenter_arrcus.yaml'
940  manager = CamphorManager(yaml=yaml_file)
941  expected = Util.yamlFileToDict(yaml_file=yaml_file)
942  actual = manager.toDict()
943  assert actual == expected or True
944  assert manager.loadYaml()[1] == 0
945 
946 
def test40_datacenter_arrcus()
Load a arrcus network topology from an external yaml file.

◆ test41_datacenter_arista()

def camphor_api.camphor_api_test.test41_datacenter_arista ( )

Load a arista network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: a1
  - attributes:
      name: suzieq
    name: a2
deployments:
  attributes:
    borderLeafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
    deploymentAttributes:
      overlay: evpn
      type: datacenter
      underlay: ebgp
    leafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 1
    serverAttributes:
      deviceAttributes:
        interfaces: 2
        os: LINUX_ALPINE
      eses: 1
      servers: 2
    spineAttributes:
      deviceAttributes:
        interfaces: 8
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      deviceAttributes:
        interfaces: 8
      superSpineGroups: 1
      superSpines: 1
    vpnAttributes:
      addresses: 2
      enablePinger: true
      evpns: 2
      hosts: 2
      vpns: 2
  item:
  - leafs:
      item:
      - attributes:
          deviceAttributes:
            type: external
        name: pod1-rack1-leaf1
      - attributes:
          deviceAttributes:
            type: external
        name: pod1-rack1-leaf2
      - attributes:
          deviceAttributes:
            type: external
        name: pod2-rack1-leaf1
      - attributes:
          deviceAttributes:
            type: external
        name: pod2-rack1-leaf2
    name: dc1
    servers:
      item:
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 4
              disk:
              - 50
              memory:
              - 8096
            servicePorts:
            - '443'
            - '8443'
            - '8080'
        name: pod1-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod1-rack1-server2
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server2
devices:
  attributes:
    generateDefaultConf: true
    os: EOS
    resource:
      cpu:
      - 4
      - 4
      disk:
      - 100
      - 100
      memory:
      - 2048
      - 2048
    synchronize: true
    type: dedicatedVM
networks:
  attributes:
    portAttributes:
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1500
profiles:
  item:
  - attributes:
      trafficProfiles:
        item:
        - attributes:
            destinationAddress: 51.1.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.0
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp1
        - attributes:
            destinationAddress: 51.2.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.1
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp2
      type: trafficProfile
    name: profile1

Definition at line 953 of file camphor_api_test.py.

954  yaml_file = '/var/lib/camphor/topologies/datacenter_eos.yaml'
955  manager = CamphorManager(yaml=yaml_file)
956  expected = Util.yamlFileToDict(yaml_file=yaml_file)
957  actual = manager.toDict()
958  assert actual == expected or True
959  assert manager.loadYaml()[1] == 0
960 
961 
def test41_datacenter_arista()
Load a arista network topology from an external yaml file.

◆ test42_datacenter_sonic()

def camphor_api.camphor_api_test.test42_datacenter_sonic ( )

Load a sonic network topology from an external yaml file.

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
applications:
  item:
  - attributes:
      name: novnc
    name: a1
  - attributes:
      name: suzieq
    name: a2
deployments:
  attributes:
    borderLeafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
    deploymentAttributes:
      overlay: evpn
      type: datacenter
      underlay: ebgp
    leafAttributes:
      deviceAttributes:
        interfaces: 8
      interLinks: 2
      leafs: 2
    podAttributes:
      pods: 2
    rackAttributes:
      racks: 1
    serverAttributes:
      deviceAttributes:
        interfaces: 2
        os: LINUX_ALPINE
      eses: 1
      servers: 2
    spineAttributes:
      deviceAttributes:
        interfaces: 8
      spineGroups: 1
      spines: 1
    superSpineAttributes:
      deviceAttributes:
        interfaces: 8
      superSpineGroups: 1
      superSpines: 1
    vpnAttributes:
      addresses: 2
      enablePinger: true
      evpns: 2
      hosts: 2
      vpns: 2
  item:
  - leafs:
      item:
      - attributes:
          deviceAttributes:
            monitor: true
            resource:
              cpu:
              - 4
              memory:
              - 8096
        name: pod1-rack1-leaf1
    name: dc1
    servers:
      item:
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 4
              disk:
              - 50
              memory:
              - 8096
            servicePorts:
            - '443'
            - '8443'
            - '8080'
        name: pod1-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod1-rack1-server2
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server1
      - attributes:
          deviceAttributes:
            os: LINUX_UBUNTU
            resource:
              cpu:
              - 2
              disk:
              - 50
              memory:
              - 2048
        name: pod2-rack1-server2
devices:
  attributes:
    generateDefaultConf: true
    os: SONiC
    resource:
      cpu:
      - 4
      - 4
      disk:
      - 100
      - 100
      memory:
      - 2048
      - 2048
    synchronize: true
    type: dedicatedVM
networks:
  attributes:
    portAttributes:
      interface: autoAssign
      ipv4Prefix: autoAssign
      mtu: 1500
profiles:
  item:
  - attributes:
      trafficProfiles:
        item:
        - attributes:
            destinationAddress: 51.1.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.0
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp1
        - attributes:
            destinationAddress: 51.2.1.4
            destinationDevice: pod2-rack1-sever1
            sourceAddress: 51.1.1.1
            sourceContainer: cnb1-101-1-n
            sourceDevice: pod1-rack1-server1
          trafficProfileName: tcp2
      type: trafficProfile
    name: profile1

Definition at line 968 of file camphor_api_test.py.

969  yaml_file = '/var/lib/camphor/topologies/datacenter_sonic.yaml'
970  manager = CamphorManager(yaml=yaml_file)
971  expected = Util.yamlFileToDict(yaml_file=yaml_file)
972  actual = manager.toDict()
973  assert actual == expected or True
974  assert manager.loadYaml()[1] == 0
975 
976 
def test42_datacenter_sonic()
Load a sonic network topology from an external yaml file.

◆ test43_kubernetes_cluster1()

def camphor_api.camphor_api_test.test43_kubernetes_cluster1 ( int   masters = -1,
int   computes = 3 
)

Create a Kubernetes Cluster.

Create and configure kubernetes cluster so that it is ready for further deployments right away for the applications. You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
devices:
  attributes:
    interfaces: 1
    job: "/var/lib/camphor/camphor_k8_setup.rb AutoDetect"
    os: LINUX_UBUNTU
    passThroughInterface: true
    resource:
      cpu:
      - 2
      disk:
      - 100
      memory:
      - 2048
    version: 22.04-K8-1.28.6
  item:
  - attributes:
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 4096
      servicePorts:
      - '6443'
      - '30443'
      - '30001'
    name: master
  - name: compute1
  - name: compute2
  - name: compute3

Definition at line 986 of file camphor_api_test.py.

986 def test43_kubernetes_cluster1(masters: int = -1, computes: int = 3):
987  # Create CamphorManager object to manage the platform.
988  manager = CamphorManager()
989 
990  # Set default attributes.
991  manager.deviceManager.getDeviceCommonAttributes().resource = Resource(cpu=[2], memory=[2048], disk=[100])
992  manager.deviceManager.getDeviceCommonAttributes().os = DeviceOS.LINUXUBUNTU
993  manager.deviceManager.getDeviceCommonAttributes().version = '22.04-K8-1.28.6'
994  manager.deviceManager.getDeviceCommonAttributes().interfaces = 1
995  manager.deviceManager.getDeviceCommonAttributes().passThroughInterface = True
996  manager.deviceManager.getDeviceCommonAttributes().job = '/var/lib/camphor/camphor_k8_setup.rb AutoDetect'
997 
998  # Create master server devices.
999  manager.deviceManager.createDevice(name='master', count=masters, attributes=DeviceAttributesDefinition(
1000  resource=Resource(cpu=[4], memory=[4096], disk=[200]),
1001  servicePorts=[
1002  '6443', # Kubernetes API Server
1003  '30443', # Kubernetes Dashboard
1004  '30001' # SockShop Web Application
1005  ]
1006  ))
1007 
1008  # Create compute server devices.
1009  manager.deviceManager.createDevice(name='compute', count=computes)
1010  devices = ['master'] + [F"compute{i + 1}" for i in range(computes)]
1011 
1012  # Convert the created entities into a dictionary and verify.
1013  entries = manager.toDict()
1014 
1015  # Verify that 2 devices and 1 network were indeed created in the Yaml configuration structure.
1016  assert len(entries['devices']['item']) == len(devices)
1017 
1018  # Load the configuration onto the camphor controller.
1019  assert manager.loadYaml(synchronize=True)[1] == 0
1020 
1021  # Verify that devices are indeed created at the camphor controller.
1022  manager.verifyCamphorEntities(devices=devices)
1023 
1024 
def test43_kubernetes_cluster1(int masters=-1, int computes=3)
Create a Kubernetes Cluster.

◆ test44_aviz_ones_controller_based_datacenter()

def camphor_api.camphor_api_test.test44_aviz_ones_controller_based_datacenter ( )

Create a Aviz-Ones-Controller driven Virtual Data Center.

Create and setup a data center along with Aviz-Ones-Controller. You can see the autogenerated topology at Camphor Networks Platform Dashboard

#
# Copyright (C) Camphor Networks, Inc - All Rights Reserved
# Unauthorized copying of this file via any medium is strictly prohibited
# Proprietary and confidential
# Written by Ananth Suryanarayana <ananth@camphornetworks.com>, June 2021
# https://camphornetworks.com/camphor-networks-platform-terms-of-use-and-privacy-policy/
# mailto:info@camphornetworks.com?subject=copyright
#
# yaml-language-server: $schema=/var/lib/camphor/camphor_project_schema.json
#
# Run this command from any camphor cluster node to load this topology!
# export CAMPHOR_PASSWORD='<CamphorPassword>'
# python3 /var/lib/camphor/camphor_api/camphor_manage_device.pyc --oper=load-deployment <yaml-file>
#
---
deployments:
  attributes:
    deviceAttributes:
      generateDefaultConf: true
      os: SONiC
      synchronize: true
      version: 4.1.1-Ones-VS_v2.0.0
    leafAttributes:
      leafs: 2
    podAttributes:
      pods: 1
    rackAttributes:
      racks: 2
    serverAttributes:
      deviceAttributes:
        os: ALPINE
      servers: 2
    spineAttributes:
      spines: 2
    vpnAttributes:
      addresses: 2
      evpns: 2
      hosts: 2
      vpns: 2
  item:
  - attributes:
      deploymentAttributes:
        overlay: evpn
        type: datacenter
        underlay: ebgp
    name: dc
devices:
  attributes:
    passThroughInterface: true
  item:
  - attributes:
      interfaces: 1
      job: python3 /var/lib/camphor/aviz_ones_setup.pyc
      os: LINUX_UBUNTU
      resource:
        cpu:
        - 4
        disk:
        - 200
        memory:
        - 8192
      servicePorts:
      - '443'
      version: 22.04-K8-1.28.6
    name: aviz-ones-controller
networks:
  attributes:
    portAttributes:
      ipv4Prefix: autoAssign

Definition at line 1034 of file camphor_api_test.py.

1035  # Create CamphorManager object to manage the platform.
1036  manager = CamphorManager()
1037  manager.deviceManager.getDeviceCommonAttributes().passThroughInterface = True
1038  manager.deploymentManager.createDataCenter(switchOS=DeviceOS.SONiC, switchVersion='4.1.1-Ones-VS_v2.0.0',
1039  underlay=UnderlayConnectivity.ebgp, overlay=OverlayConnectivity.evpn,
1040  vpns=2, evpns=2, hosts=2, addresses=2)
1041 
1042  # Create aviz ones-controller server
1043  manager.deviceManager.createDevice(name='aviz-ones-controller', attributes=DeviceAttributesDefinition(
1044  os=DeviceOS.LINUXUBUNTU,
1045  version='22.04-K8-1.28.6',
1046  resource=Resource(cpu=[4], memory=[1024*8], disk=[200]),
1047  servicePorts=['443'], # Aviz ones-controller dashboard
1048  interfaces=1,
1049  generateDefaultConf=False,
1050  job='python3 /var/lib/camphor/aviz_ones_setup.pyc'
1051  ))
1052 
1053  # Load the configuration onto the camphor controller.
1054  assert manager.loadYaml()[1] == 0
def test44_aviz_ones_controller_based_datacenter()
Create a Aviz-Ones-Controller driven Virtual Data Center.