fabric-testbed / fabrictestbed-extensions

Extensions for the fabric APUI/CLI.
MIT License
6 stars 12 forks source link

Failures when adding interfaces to a network #329

Closed kthare10 closed 3 months ago

kthare10 commented 3 months ago

Fabfed team noticed errors when adding interface to a network.

Automatic NS Type computed in this case is L2PTP which is rejected as L2PTP is not supported for Basic NICs.

Fix: Update the calculate_ns_type to use L2STS when basic nics are attached.

kthare10 commented 3 months ago

Code snippet shared by Abdelilah:

slice_name = 'aes-chameleon'
network_name='net1'
slice = fablib.new_slice(name=slice_name)
fabric_site='TACC'
faciliy_port='Chameleon-TACC'
network_vlan=3210
fabric_facility_port = slice.add_facility_port(name=faciliy_port, site=fabric_site, vlan=str(network_vlan))
fabric_facility_port_iface = fabric_facility_port.get_interfaces()[0]
fabric_facility_port_iface.set_mode('manual')

node2 = slice.add_node(name="bnode", site="UTAH")
iface2 = node2.add_component(model='NIC_Basic', name='nic1').get_interfaces()[0]
iface2.set_mode('manual')

# CASE1: This does not work.
# net1 = slice.add_l2network(name=network_name, type="L2STS")
# net1.add_interface(iface2)
# net1.add_interface(fabric_facility_port_iface)
# Exception: ['Network type L2STS must include interfaces from exactly two sites. 0 sites requested: set()']

# CASE2: This does not work. Looks like type must be set. 
# net1 = slice.add_l2network(name=network_name, interfaces=[iface2,fabric_facility_port_iface])
# Exception: Network type L2PTP does not support interfaces of type 'NIC_Basic'

# CASE3: This works.
net1 = slice.add_l2network(name=network_name, type="L2STS", interfaces=[iface2,fabric_facility_port_iface])
slice.submit()