def _add_flat_link_interfaces(self, interfaces, dps, dp_index): if dp_index < len(dps) - 1: next_dp = dps[dp_index + 1] next_port = FLAT_LINK_PORT_START + dp_index description = ("to %s port %s" % (next_dp, next_port)) interfaces[next_port] = Interface( description=description, stack=StackLink(dp=next_dp, port=next_port)) if dp_index > 0: prev_dp = dps[dp_index - 1] prev_port = FLAT_LINK_PORT_START + (len(dps) + dp_index - 1) % len(dps) description = ("to %s port %s" % (prev_dp, prev_port)) interfaces[prev_port] = Interface( description=description, stack=StackLink(dp=prev_dp, port=prev_port))
def _add_t2_stack_interfaces(self, interfaces, dp_index, t1_dps): t1_port = T1_STACK_PORT_START + dp_index for index, t1_dp in enumerate(t1_dps): port = T2_STACK_PORT_START + index * 2 description = ('to %s port %s' % (t1_dp, t1_port)) interfaces[port] = Interface( description=description, stack=StackLink(dp=t1_dp, port=t1_port))
def _build_t1_interfaces(self, dp_index, t1_dps, t2_dps, t2_port, tagged_vlans, tap_vlan=None): interfaces = {} if tap_vlan: interfaces[4] = Interface(description='tap', tagged_vlans=[tap_vlan]) for index, dp_name in enumerate(t1_dps): if abs(dp_index - index) == 1: port = 6 + min(dp_index, index) description = ("to %s port %s" % (dp_name, port)) interfaces[port] = Interface(description=description, stack=StackLink(dp=dp_name, port=port)) for index, dp_name in enumerate(t2_dps): port = 100 + index description = ("to %s port %s" % (dp_name, t2_port)) interfaces[port] = Interface(description=description, stack=StackLink(dp=dp_name, port=t2_port)) interfaces[28] = Interface(description='egress', lacp=3, tagged_vlans=tagged_vlans) return interfaces
def _build_t2_interfaces(self, dp_index, t1_dps, access_ports, native_vlan, port_acl): interfaces = {} for index in range(access_ports): interfaces[index + 101] = Interface(description='IoT Device', native_vlan=native_vlan, acl_in=port_acl, max_hosts=1) for index, dp_name in enumerate(t1_dps): port = 50 + index * 2 description = ('to %s port %s' % (dp_name, 100+dp_index)) interfaces[port] = Interface(description=description, stack=StackLink(dp=dp_name, port=100+dp_index)) return interfaces