Exemple #1
0
 def _add_egress_interface(self, interfaces, egress_port, tagged_vlans, lacp):
     if lacp:
         interfaces[egress_port] = Interface(
             description='egress', lacp=LACP_MODE, tagged_vlans=tagged_vlans)
     else:
         interfaces[egress_port] = Interface(
             description='egress', tagged_vlans=tagged_vlans)
Exemple #2
0
 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
Exemple #3
0
    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))
Exemple #4
0
 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))
Exemple #5
0
 def _add_access_interfaces(self, interfaces, access_ports,
                            access_port_start, native_vlan, port_acl):
     for index in range(access_ports):
         interfaces[index + access_port_start] = Interface(
             description='IoT Device',
             native_vlan=native_vlan,
             acl_in=port_acl,
             max_hosts=1)
Exemple #6
0
 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
Exemple #7
0
 def _add_tap_interface(self, interfaces, tap_vlan):
     interfaces[TAP_PORT] = Interface(description='TAP',
                                      tagged_vlans=[tap_vlan])