summaryrefslogtreecommitdiffstats
path: root/vswitches/vswitch.py
blob: a28c0f6b475c6fe2b78b464bdb29a80e5a9ed16f (plain)
1
2
3
4
5
6

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /*
# Copyright 2015 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Generic interface VSPERF uses for controlling a vSwitch
"""

class IVSwitch(object):
    """Interface class that is implemented by vSwitch-specific classes

    Other methods are called only between start() and stop()
    """
    def start(self):
        """Start the vSwitch

        If vSwitch is split to multiple processes, has kernel modules etc.,
        this is expected to set them all up in correct sequence
        """
        raise NotImplementedError()

    def stop(self):
        """Stop the vSwitch

        If vSwitch is split to multiple processes, has kernel modules etc.,
        this is expected to terminate and clean all of them in correct sequence
        """
        raise NotImplementedError()

    def add_switch(self, switch_name, params):
        """Create a new logical switch with no ports

        :param switch_name: The name of the new logical switch
        :param params: Optional parameters to configure switch

        :returns: None
        """
        raise NotImplementedError()

    def del_switch(self, switch_name):
        """Destroy the given logical switch

        :param switch_name: The name of the logical switch to be destroyed
        :returns: None
        """
        raise NotImplementedError()

    def add_phy_port(self, switch_name):
        """Create a new port to the logical switch that is attached to a
        physical port

        :param switch_name: The switch where the port is attached to
        :returns: (port name, OpenFlow port number)
        """
        raise NotImplementedError()

    def add_vport(self, switch_name):
        """Create a new port to the logical switch for VM connections

        :param switch_name: The switch where the port is attached to
        :returns: (port name, OpenFlow port number)
        """
        raise NotImplementedError()

    def get_ports(self, switch_name):
        """Return a list of tuples describing the ports of the logical switch

        :param switch_name: The switch whose ports to return
        :returns: [(port name, OpenFlow port number), ...]
        """
        raise NotImplementedError()

    def del_port(self, switch_name, port_name):
        """Delete the port from the logical switch

        The port can be either physical or virtual

        :param switch_name: The switch on which to operate
        :param port_name: The port to delete
        """
        raise NotImplementedError()

    def add_flow(self, switch_name, flow, cache='off'):
        """Add a flow rule to the logical switch

        :param switch_name: The switch on which to operate
        :param flow: Flow description as a dictionary
        :param cache: Optional. Specifies if flow should be inserted
            to the switch or cached to increase performance during manipulation
            with large number of flows.
            Values:
                'off'   - cache is off and flow is inserted directly to the switch
                'on'    - cache is on and flow is inserted into the cache
                'flush' - cache content will be inserted into the switch

        Example flow dictionary:
            flow = {
                'in_port': '1',
                'idle_timeout': '0',
                'actions': ['output:3']
            }
        """
        raise NotImplementedError()

    def del_flow(self, switch_name, flow=None):
        """Delete the flow rule from the logical switch

        :param switch_name: The switch on which to operate
        :param flow: Flow description as a dictionary

        For flow dictionary description, see add_flow
        For flow==None, all flows are deleted
        """
        raise NotImplementedError()

    def dump_flows(self, switch_name):
        """Dump flows from the logical switch

        :param switch_name: The switch on which to operate
        """
        raise NotImplementedError()