コード例 #1
0
ファイル: dp.py プロジェクト: fortitudepub/faucet
 def _configure_tables(self, override_table_config, valve_cl,
                       vlan_port_factor):
     """Configure FAUCET pipeline with tables."""
     tables = {}
     self.groups = ValveGroupTable()
     relative_table_id = 0
     for table_id, table_config in enumerate(
             faucet_pipeline.FAUCET_PIPELINE):
         table_name = table_config.name
         if table_name in override_table_config:
             table_config = override_table_config[table_name]
         size = self.table_sizes.get(table_name,
                                     self.min_wildcard_table_size)
         if table_config.vlan_port_scale:
             size = max(
                 size,
                 int(vlan_port_factor *
                     float(table_config.vlan_port_scale)))
         if not table_config.exact_match:
             size = min(size, self.max_wildcard_table_size)
             size = int(size / self.min_wildcard_table_size
                        ) * self.min_wildcard_table_size
         table_config.size = size
         if table_config.match_types:
             if not valve_cl.STATIC_TABLE_IDS:
                 table_id = relative_table_id
             tables[table_name] = ValveTable(
                 table_id,
                 table_name,
                 table_config,
                 self.cookie,
                 notify_flow_removed=self.use_idle_timeout)
             relative_table_id += 1
     self.tables = tables
コード例 #2
0
ファイル: dp.py プロジェクト: girishprb/faucet
    def _configure_tables(self, valve_cl):
        """Configure FAUCET pipeline with tables."""
        tables = {}
        self.groups = ValveGroupTable()
        relative_table_id = 0
        included_tables = copy.deepcopy(
            faucet_pipeline.MINIMUM_FAUCET_PIPELINE_TABLES)
        acl_tables = self._generate_acl_tables()
        included_tables.update(acl_tables.keys())
        # Only configure IP routing tables if enabled.
        for vlan in self.vlans.values():
            for ipv in vlan.ipvs():
                included_tables.add('ipv%u_fib' % ipv)
                included_tables.add('vip')
        if valve_cl.STATIC_TABLE_IDS:
            included_tables.add('port_acl')
        if self.hairpin_ports:
            included_tables.add('eth_dst_hairpin')
        relative_table_id = 0
        table_configs = {}
        for canonical_table_config in faucet_pipeline.FAUCET_PIPELINE:
            table_name = canonical_table_config.name
            if table_name not in included_tables:
                continue
            table_config = acl_tables.get(
                table_name, copy.deepcopy(canonical_table_config))
            if not valve_cl.STATIC_TABLE_IDS:
                table_config.table_id = relative_table_id
            relative_table_id += 1
            table_configs[table_name] = table_config

        for table_name, table_config in table_configs.items():
            size = self.table_sizes.get(table_name,
                                        self.min_wildcard_table_size)
            if table_config.vlan_port_scale:
                vlan_port_factor = len(self.vlans) * len(self.ports)
                size = max(
                    size,
                    int(vlan_port_factor *
                        float(table_config.vlan_port_scale)))
            if not table_config.exact_match:
                size = min(size, self.max_wildcard_table_size)
                size = int(size / self.min_wildcard_table_size
                           ) * self.min_wildcard_table_size
            table_config.size = size
            table_config.next_tables = [
                table_name for table_name in table_config.next_tables
                if table_name in table_configs
            ]
            next_table_ids = [
                table_configs[table_name].table_id
                for table_name in table_config.next_tables
            ]
            tables[table_name] = ValveTable(
                table_name,
                table_config,
                self.cookie,
                notify_flow_removed=self.use_idle_timeout,
                next_tables=next_table_ids)
        self.tables = tables
コード例 #3
0
ファイル: dp.py プロジェクト: joydenfew/faucet
 def _configure_tables(self):
     """Configure FAUCET pipeline of tables with matches."""
     self.groups = ValveGroupTable()
     for table_id, table_config in enumerate(faucet_pipeline.FAUCET_PIPELINE):
         table_name, restricted_match_types = table_config
         self.tables[table_name] = ValveTable(
             table_id, table_name, restricted_match_types,
             self.cookie, notify_flow_removed=self.use_idle_timeout)
         self.tables_by_id[table_id] = self.tables[table_name]
コード例 #4
0
 def _configure_tables(self):
     """Configure FAUCET pipeline of tables with matches."""
     self.groups = ValveGroupTable()
     for table_id, table_config in enumerate((
             ('port_acl', None),
             ('vlan', ('eth_dst', 'eth_type', 'in_port', 'vlan_vid')),
             ('vlan_acl', None),
             ('eth_src', ('eth_dst', 'eth_src', 'eth_type', 'in_port', 'vlan_vid')),
             ('ipv4_fib', ('eth_type', 'ipv4_dst', 'vlan_vid')),
             ('ipv6_fib', ('eth_type', 'ipv6_dst', 'vlan_vid')),
             ('vip', ('arp_tpa', 'eth_dst', 'eth_type', 'icmpv6_type', 'ip_proto')),
             ('eth_dst', ('eth_dst', 'in_port', 'vlan_vid')),
             ('flood', ('eth_dst', 'in_port', 'vlan_vid')))):
         table_name, restricted_match_types = table_config
         self.tables[table_name] = ValveTable(
             table_id, table_name, restricted_match_types,
             self.cookie, notify_flow_removed=self.use_idle_timeout)
         self.tables_by_id[table_id] = self.tables[table_name]
コード例 #5
0
ファイル: dp.py プロジェクト: lantz/faucet2
 def _configure_tables(self, override_table_config):
     """Configure FAUCET pipeline with tables."""
     tables = {}
     self.groups = ValveGroupTable()
     for table_id, table_config in enumerate(
             faucet_pipeline.FAUCET_PIPELINE):
         table_name = table_config.name
         if table_name in override_table_config:
             table_config = override_table_config[table_name]
         # TODO: automatically calculate
         table_config.size = self.table_sizes.get(table_name, 128)
         if table_config.match_types:
             tables[table_name] = ValveTable(
                 table_id,
                 table_name,
                 table_config,
                 self.cookie,
                 notify_flow_removed=self.use_idle_timeout)
     self.tables = copy.deepcopy(tables)
コード例 #6
0
    def _configure_tables(self, valve_cl):
        """Configure FAUCET pipeline with tables."""
        tables = {}
        self.groups = ValveGroupTable()
        relative_table_id = 0
        included_tables = copy.deepcopy(
            faucet_pipeline.MINIMUM_FAUCET_PIPELINE_TABLES)
        acl_tables = self._generate_acl_tables()
        included_tables.update(acl_tables.keys())
        # Only configure IP routing tables if enabled.
        for vlan in self.vlans.values():
            for ipv in vlan.ipvs():
                included_tables.add('ipv%u_fib' % ipv)
                included_tables.add('vip')
        if valve_cl.STATIC_TABLE_IDS:
            included_tables.add('port_acl')
        if self.hairpin_ports:
            included_tables.add('eth_dst_hairpin')
        if self.use_classification:
            included_tables.add('classification')
        if self.egress_pipeline:
            included_tables.add('egress')
        canonical_configs = [
            config for config in faucet_pipeline.FAUCET_PIPELINE
            if config.name in included_tables
        ]
        table_configs = {}
        for relative_table_id, canonical_table_config in enumerate(
                canonical_configs, start=0):
            name = canonical_table_config.name
            table_config = acl_tables.get(
                name, copy.deepcopy(canonical_table_config))
            if not self.egress_pipeline:
                table_config.metadata_write = 0
                table_config.metadata_match = 0
            if not valve_cl.STATIC_TABLE_IDS:
                table_config.table_id = relative_table_id
            table_configs[name] = table_config

        # Stacking with external ports, so need loop protection field.
        if self.stack and self.stack.get('externals', False):
            flood_table = table_configs['flood']
            flood_table.set_fields = (
                faucet_pipeline.STACK_LOOP_PROTECT_FIELD, )
            flood_table.match_types += ((
                faucet_pipeline.STACK_LOOP_PROTECT_FIELD, False), )

        for table_name, table_config in table_configs.items():
            size = self.table_sizes.get(table_name,
                                        self.min_wildcard_table_size)
            if table_config.vlan_port_scale:
                vlan_port_factor = len(self.vlans) * len(self.ports)
                size = max(
                    size,
                    int(vlan_port_factor *
                        float(table_config.vlan_port_scale)))
            if not table_config.exact_match:
                size = min(size, self.max_wildcard_table_size)
                size = int(size / self.min_wildcard_table_size
                           ) * self.min_wildcard_table_size
            table_config.size = size
            table_config.next_tables = [
                table_name for table_name in table_config.next_tables
                if table_name in table_configs
            ]
            next_table_ids = [
                table_configs[table_name].table_id
                for table_name in table_config.next_tables
            ]
            tables[table_name] = ValveTable(
                table_name,
                table_config,
                self.cookie,
                notify_flow_removed=self.use_idle_timeout,
                next_tables=next_table_ids)
        self.tables = tables