Ejemplo n.º 1
0
    def create_flat_faucet_config(self, num_switches, num_access_ports):
        """Create Faucet config with flat topology"""
        setup_vlan = SETUP_VLAN
        switches = [('sw%s' % (sw_num + 1)) for sw_num in range(num_switches)]
        dps = {}
        vlans = {setup_vlan: Vlan(description='Faucet IoT')}

        for sw_num, sw_name in enumerate(switches):
            interfaces = self._build_dp_interfaces(
                sw_num,
                dps=switches,
                egress_port=FAUCET_EGRESS_PORT,
                tagged_vlans=[setup_vlan],
                access_ports=num_access_ports,
                native_vlan=setup_vlan,
                port_acl='uniform_acl',
                access_port_start=FLAT_ACCESS_PORT_START,
                lacp=True)
            dps[sw_name] = self._build_datapath_config(
                FLAT_DP_ID_START + sw_num, interfaces,
                self._generate_dp_mac(T2_DP, sw_num))

        return FaucetConfig(dps=dps,
                            version=2,
                            include=['uniform.yaml'],
                            vlans=vlans)
Ejemplo n.º 2
0
    def create_scale_faucet_config(self, t1_switches, t2_switches, access_ports):
        """Create Faucet config with stacking topology"""
        setup_vlan = SETUP_VLAN
        test_vlan = TEST_VLAN
        vlans = {
            setup_vlan: Vlan(description='Faucet IoT'),
            test_vlan: Vlan(description='Orchestrated Testing')
        }
        t1_dps = [('nz-kiwi-t1sw%s' % (dp_index + 1)) for dp_index in range(t1_switches)]
        t2_dps = [('nz-kiwi-t2sw%s' % (dp_index + 1)) for dp_index in range(t2_switches)]
        dps = {}
        for dp_index, dp_name in enumerate(t1_dps):
            tap_vlan = test_vlan if not dp_index else None
            interfaces = self._build_dp_interfaces(
                dp_index, dps=t1_dps, t2_dps=t2_dps, tagged_vlans=[setup_vlan],
                tap_vlan=tap_vlan, egress_port=FAUCET_EGRESS_PORT, lacp=True)
            dps[dp_name] = self._build_datapath_config(
                T1_DP_ID_START + dp_index, interfaces, self._generate_dp_mac(T1_DP, dp_index))

        for dp_index, dp_name in enumerate(t2_dps):
            interfaces = self._build_dp_interfaces(
                dp_index, t1_dps=t1_dps, access_ports=access_ports, native_vlan=setup_vlan,
                port_acl='uniform_acl', lacp=True)
            dps[dp_name] = self._build_datapath_config(
                T2_DP_ID_START + dp_index, interfaces, self._generate_dp_mac(T2_DP, dp_index))
        return FaucetConfig(dps=dps, version=2, include=['uniform.yaml'], vlans=vlans)
Ejemplo n.º 3
0
    def create_corp_faucet_config(self):
        """Create Faucet config for corp network"""
        setup_vlan = SETUP_VLAN
        switch = 'corp'
        dps = {}

        interfaces = self._build_dp_interfaces(
            CORP_DP_ID, tagged_vlans=[setup_vlan], access_ports=1, access_port_start=1,
            native_vlan=setup_vlan, egress_port=CORP_EGRESS_PORT)
        dps[switch] = self._build_datapath_config(CORP_DP_ID, interfaces)

        return FaucetConfig(dps=dps, version=2)
Ejemplo n.º 4
0
    def _create_scale_faucet_config(self, t1_switches, t2_switches, access_ports):
        setup_vlan = 171
        test_vlan = 272
        vlans = {
            setup_vlan: Vlan(description='Faucet IoT'),
            test_vlan: Vlan(description='Orchestrated Testing')
        }
        t1_dps = [('nz-kiwi-t1sw%s' % (dp_index + 1)) for dp_index in range(t1_switches)]
        t2_dps = [('nz-kiwi-t2sw%s' % (dp_index + 1)) for dp_index in range(t2_switches)]
        dps = {}
        for dp_index, dp_name in enumerate(t1_dps):
            tap_vlan = test_vlan if not dp_index else None
            interfaces = self._build_t1_interfaces(dp_index, t1_dps, t2_dps,
                                                   50 + dp_index * 2, [setup_vlan], tap_vlan)
            dps[dp_name] = self._build_datapath_config(
                177 + dp_index, ('0e:00:00:00:01:%s' % ("{:02x}".format(dp_index+1))), interfaces)

        for dp_index, dp_name in enumerate(t2_dps):
            interfaces = self._build_t2_interfaces(dp_index,
                                                   t1_dps, access_ports, setup_vlan, 'uniform_acl')
            dps[dp_name] = self._build_datapath_config(
                1295 + dp_index, ('0e:00:00:00:02:%s' % ("{:02x}".format(dp_index+1))), interfaces)
        return FaucetConfig(dps=dps, version=2, include=['uniform.yaml'], vlans=vlans)