Ejemplo n.º 1
0
    def add_switch(self, switch_name, params=None):
        """See IVswitch for general description
        """
        # create and configure new ovs bridge and delete all default flows
        bridge = OFBridge(switch_name)
        bridge.create(params)
        bridge.del_flow({})
        bridge.set_db_attribute('Open_vSwitch', '.', 'other_config:max-idle',
                                settings.getValue('VSWITCH_FLOW_TIMEOUT'))
        self._switches[switch_name] = bridge
        if settings.getValue('OVS_ROUTING_TABLES'):
            # table#0 - flows designed to force 5 & 13 tuple matches go here
            flow = {'table': '0', 'priority': '1', 'actions': ['goto_table:1']}
            bridge.add_flow(flow)

            # table#1 - flows to route packets between ports goes here. The
            # chosen port is communicated to subsequent tables by setting the
            # metadata value to the egress port number
            #
            # A placeholder - flows are added into this table by deployments
            #                 or by TestSteps via add_connection() method

            # table#2 - frame modification table. Frame modification flow rules are
            # isolated in this table so that they can be turned on or off
            # without affecting the routing or tuple-matching flow rules.
            flow = {'table': '2', 'priority': '1', 'actions': ['goto_table:3']}
            bridge.add_flow(flow)

            # table#3 - egress table
            # (NOTE) Billy O'Mahony - the drop action here actually required in
            # order to egress the packet. This is the subject of a thread on
            # ovs-discuss 2015-06-30.
            flow = {'table': '3', 'priority': '1', 'actions': ['drop']}
            bridge.add_flow(flow)
Ejemplo n.º 2
0
 def add_switch(self, switch_name, params=None):
     """See IVswitch for general description
     """
     bridge = OFBridge(switch_name)
     bridge.create(params)
     bridge.set_db_attribute('Open_vSwitch', '.',
                             'other_config:max-idle', '60000')
     self._bridges[switch_name] = bridge
Ejemplo n.º 3
0
 def add_switch(self, switch_name, params=None):
     """See IVswitch for general description
     """
     bridge = OFBridge(switch_name)
     bridge.create(params)
     bridge.set_db_attribute('Open_vSwitch', '.', 'other_config:max-idle',
                             settings.getValue('VSWITCH_FLOW_TIMEOUT'))
     self._bridges[switch_name] = bridge
Ejemplo n.º 4
0
 def configure(self):
     """ Configure vswitchd DPDK options through ovsdb if needed
     """
     dpdk_config = S.getValue('VSWITCHD_DPDK_CONFIG')
     if dpdk_config and not self.old_dpdk_config():
         # override socket-mem settings
         dpdk_config['dpdk-socket-mem'] = ','.join(S.getValue('DPDK_SOCKET_MEM'))
         # enforce calls to ovs-vsctl with --no-wait
         tmp_br = OFBridge(timeout=-1)
         for option in dpdk_config:
             tmp_br.set_db_attribute('Open_vSwitch', '.',
                                     'other_config:' + option, dpdk_config[option])
Ejemplo n.º 5
0
    def start(self):
        """See IVswitch for general description

        Activates DPDK kernel modules, ovsdb and vswitchd.
        """
        dpdk.init()
        super(OvsDpdkVhost, self).start()
        # old style OVS <= 2.5.0 multi-queue enable
        if S.getValue('OVS_OLD_STYLE_MQ') and \
                int(S.getValue('VSWITCH_DPDK_MULTI_QUEUES')):
            tmp_br = OFBridge(timeout=-1)
            tmp_br.set_db_attribute('Open_vSwitch', '.',
                                    'other_config:' + 'n-dpdk-rxqs',
                                    S.getValue('VSWITCH_DPDK_MULTI_QUEUES'))
Ejemplo n.º 6
0
    def add_switch(self, switch_name, params=None):
        """See IVswitch for general description
        """
        bridge = OFBridge(switch_name)
        if params is None:
            bridge.create(
                ['--', 'set', 'bridge', switch_name, 'datapath_type=netdev'])
        else:
            bridge.create(
                ['--', 'set', 'bridge', switch_name, 'datapath_type=netdev'] +
                params)

        bridge.set_db_attribute('Open_vSwitch', '.', 'other_config:max-idle',
                                settings.getValue('VSWITCH_FLOW_TIMEOUT'))

        if settings.getValue('VSWITCH_AFFINITIZATION_ON') == 1:
            # Sets the PMD core mask to VSWITCH_PMD_CPU_MASK
            # for CPU core affinitization
            bridge.set_db_attribute('Open_vSwitch', '.',
                                    'other_config:pmd-cpu-mask',
                                    settings.getValue('VSWITCH_PMD_CPU_MASK'))

        self._bridges[switch_name] = bridge