aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2016-12-20 10:01:20 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-21 22:47:32 +0000
commitc4d1cf76072b54f630b0263cd86e01df82249568 (patch)
tree212bd23d4b7464669a407eb8711e187ca5c3171c /vpp-api/java
parent1099b0db45a7a0bb597c4deb5b9387f5b6ae280f (diff)
API refactoring : l2tp
Change-Id: I30d2785ceaf304b245192f9bce60e37e9da69023 Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
Diffstat (limited to 'vpp-api/java')
-rw-r--r--vpp-api/java/Makefile.am2
1 files changed, 2 insertions, 0 deletions
diff --git a/vpp-api/java/Makefile.am b/vpp-api/java/Makefile.am
index 8a2d0393013..4542f41544f 100644
--- a/vpp-api/java/Makefile.am
+++ b/vpp-api/java/Makefile.am
@@ -91,6 +91,7 @@ jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: \
$(prefix)/../vpp/vpp-api/vpe.api.json \
$(prefix)/../vnet/vnet/gre.api.json \
$(prefix)/../vnet/vnet/ip.api.json \
+ $(prefix)/../vnet/vnet/l2tp.api.json \
$(prefix)/../vnet/vnet/tap.api.json \
$(prefix)/../vnet/vnet/vxlan.api.json \
$(prefix)/../vnet/vnet/vxlan_gpe.api.json
@@ -106,6 +107,7 @@ jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: \
$(prefix)/../vnet/vnet/gre.api.json \
$(prefix)/../vnet/vnet/interface.api.json \
$(prefix)/../vnet/vnet/l2.api.json \
+ $(prefix)/../vnet/vnet/l2tp.api.json \
$(prefix)/../vnet/vnet/map.api.json \
$(prefix)/../vnet/vnet/ip.api.json \
$(prefix)/../vnet/vnet/span.api.json \
0 } /* 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 */
import os, sys
import unittest
from trex import CTRexScenario
from stateful_tests.trex_general_test import CTRexGeneral_Test
from trex_stl_lib.api import *
import time
from nose.tools import nottest

class CStlGeneral_Test(CTRexGeneral_Test):
    """This class defines the general stateless testcase of the TRex traffic generator"""

    def setUp(self):
        self.stl_trex = CTRexScenario.stl_trex
        CTRexGeneral_Test.setUp(self)
        # check basic requirements, should be verified at test_connectivity, here only skip test
        if CTRexScenario.stl_init_error:
            self.skip(CTRexScenario.stl_init_error)

    def connect(self, timeout = 100):
        # need delay and check only because TRex process might be still starting
        sys.stdout.write('Connecting')
        for i in range(timeout):
            try:
                sys.stdout.write('.')
                sys.stdout.flush()
                self.stl_trex.connect()
                print('')
                return True
            except:
                time.sleep(0.1)
        print('')
        return False

    def map_ports(self, timeout = 100):
        sys.stdout.write('Mapping ports')
        for i in range(timeout):
            sys.stdout.write('.')
            sys.stdout.flush()
            CTRexScenario.stl_ports_map = stl_map_ports(self.stl_trex)
            if self.verify_bidirectional(CTRexScenario.stl_ports_map):
                print('')
                return True
            time.sleep(0.1)
        print('')
        return False

    # verify all the ports are bidirectional
    @staticmethod
    def verify_bidirectional(mapping_dict):
        if len(mapping_dict['unknown']):
            return False
        if len(mapping_dict['bi']) * 2 == len(mapping_dict['map']):
            return True
        return False

    @staticmethod
    def get_port_count():
        return CTRexScenario.stl_trex.get_port_count()

    @staticmethod
    def is_connected():
        return CTRexScenario.stl_trex.is_connected()

class STLBasic_Test(CStlGeneral_Test):
    # will run it first explicitly, check connectivity and configure routing
    @nottest
    def test_connectivity(self):
        if not self.is_loopback:
            try:
                if CTRexScenario.router_cfg['forceCleanConfig']:
                    CTRexScenario.router.load_clean_config()
                CTRexScenario.router.configure_basic_interfaces()
                CTRexScenario.router.config_pbr(mode = "config")
                CTRexScenario.router.config_ipv6_pbr(mode = "config")
            except Exception as e:
                CTRexScenario.stl_init_error = 'Could not configure device, err: %s' % e
                self.fail(CTRexScenario.stl_init_error)
                return
        if not self.connect():
            CTRexScenario.stl_init_error = 'Client could not connect'
            self.fail(CTRexScenario.stl_init_error)
            return
        print('Connected')
        if not self.map_ports():
            CTRexScenario.stl_init_error = 'Client could not map ports'
            self.fail(CTRexScenario.stl_init_error)
            return
        print('Got ports mapping: %s' % CTRexScenario.stl_ports_map)