summaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer.c
AgeCommit message (Expand)AuthorFilesLines
2017-09-07vlib physmem reworkDamjan Marion1-7/+65
2017-08-30Thread safe internal buffer manager, take twoDamjan Marion1-0/+19
2017-07-27Thread safe internal buffer managerDamjan Marion1-6/+1
2017-07-14Introduce l{2,3,4}_hdr_offset fields in the buffer metadataDamjan Marion1-6/+10
2017-07-10vlib: store buffer memory information in the buffer_mainDamjan Marion1-24/+33
2017-07-05Buffer name inconsistently used a cstring/vec (VPP-901)Chris Luke1-3/+3
2017-04-06Use thread local storage for thread indexDamjan Marion1-3/+3
2017-03-10Retire vpp_liteDamjan Marion1-0/+6
2017-03-09vlib_mains == 0 special cases be goneDave Barach1-3/+24
2017-03-01VPP-598: tcp stack initial commitDave Barach1-1/+1
2017-02-28vlib: add buffer cloning supportDamjan Marion1-196/+58
2017-02-06vlib: remove algned/unaligned buffers schemeDamjan Marion1-195/+25
2017-01-17dpdk: remove duplicate code in buffers.cDamjan Marion1-52/+21
2017-01-14vlib: add buffer and thread callbacksDamjan Marion1-681/+55
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+1987
{ color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
from vpp_interface import VppInterface
import socket
from util import ppp, ppc, mactobinary


class VppPppoeInterface(VppInterface):
    """
    VPP Pppoe interface
    """

    def __init__(self, test, client_ip, client_mac,
                 session_id, decap_vrf_id=0):
        """ Create VPP PPPoE4 interface """
        self._sw_if_index = 0
        super(VppPppoeInterface, self).__init__(test)
        self._test = test
        self.client_ip = client_ip
        self.client_mac = client_mac
        self.session_id = session_id
        self.decap_vrf_id = decap_vrf_id

    def add_vpp_config(self):
        cip = socket.inet_pton(socket.AF_INET, self.client_ip)
        cmac = mactobinary(self.client_mac)
        r = self.test.vapi.pppoe_add_del_session(
                cip, cmac,
                session_id=self.session_id,
                decap_vrf_id=self.decap_vrf_id)
        self._sw_if_index = r.sw_if_index
        self.generate_remote_hosts()

    def remove_vpp_config(self):
        cip = socket.inet_pton(socket.AF_INET, self.client_ip)
        cmac = mactobinary(self.client_mac)
        self.unconfig()
        r = self.test.vapi.pppoe_add_del_session(
                cip, cmac,
                session_id=self.session_id,
                decap_vrf_id=self.decap_vrf_id,
                is_add=0)


class VppPppoe6Interface(VppInterface):
    """
    VPP Pppoe IPv6 interface
    """

    def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
        """ Create VPP PPPoE6 interface """
        self._sw_if_index = 0
        super(VppPppoe6Interface, self).__init__(test)
        self._test = test
        self.client_ip = client_ip
        self.client_mac = client_mac
        self.session_id = session_id
        self.decap_vrf_id = decap_vrf_id

    def add_vpp_config(self):
        cip = socket.inet_pton(socket.AF_INET6, self.client_ip)
        cmac = mactobinary(self.client_mac)
        r = self.test.vapi.pppoe_add_del_session(
                cip, cmac,
                session_id=self.session_id,
                decap_vrf_id=self.decap_vrf_id,
                is_ip6=1)
        self._sw_if_index = r.sw_if_index
        self.generate_remote_hosts()

    def remove_vpp_config(self):
        cip = socket.inet_pton(socket.AF_INET6, self.client_ip)
        cmac = mactobinary(self.client_mac)
        self.unconfig()
        r = self.test.vapi.pppoe_add_del_session(
                cip, cmac,
                session_id=self.session_id,
                decap_vrf_id=self.decap_vrf_id,
                is_add=0,
                is_ip6=1)