fabric-testbed / InformationModel

FABRIC Information Model library
MIT License
7 stars 1 forks source link

Stitch ports and facility ports handling. #91

Closed ibaldin closed 2 years ago

ibaldin commented 2 years ago

Need to add more tests.

Addresses #70

ibaldin commented 2 years ago

Adding a facility port to substrate model ARM (assumes the switch and its MPLS network service dp_ns is defined already):

        stitch_port_facing_port = dp_ns.add_interface(name='HundredDigE0/0/0/99', itype=f.InterfaceType.TrunkPort,
                                                      node_id=dp_port_id(switch.name, 'HundredDigE0/0/0/99'),
                                                      labels=port_labs, capacities=port_caps)
        # add a facility port at RENCI
        topo.add_facility_port(name='RENCI-DC', node_id='RENCI-DC-id', peer=stitch_port_facing_port,
                                    labels=f.Labels(vlan_range='1-10', ipv4_range='192.168.1.1-192.168.1.20',
                                                  local_name='name-of-port-on-facility-switch'),
                                    capacities=f.Capacities(mtu=1500, bw=10000))

        topo.add_facility_port(name='RENCI-DC1', node_id='RENCI-DC1-id', peer=stitch_port_facing_port,
                                    labels=f.Labels(vlan_range='11-20', ipv4_range='192.168.2.1-192.168.2.20',
                                                    local_name='name-of-port-on-facility-switch'),
                                    capacities=f.Capacities(mtu=1500, bw=10000))

Adding a stitch port to ASM:

        # these have to match the name of a facility port in advertising
        # peer is an interface of some node you want to attach stitch port to
        topo.add_stitch_port(name='my-stitch-port', peer=self.topo.interface_list[1])
        topo.add_stitch_port(name='my-other-stitch-port', peer=self.topo.interface_list[2])

        # list stitch ports in topology
       topo.stitch_ports

       # remove stitch port
       topo.remove_stitch_port(name='my-stitch-port')

Note there isn't a matching remove_facility_port call - generally not needed.

ibaldin commented 2 years ago

One other change is the change in signature of a Interface.get_peer() method to Interface.get_peers() - now returns a list. Similarly ABCPropertyGraph.get_peer_connection_point() has become ABCPropertyGraph.get_peer_connection_points() (returns a list)