summaryrefslogtreecommitdiffstats
path: root/test/test_vxlan_gbp.py
AgeCommit message (Expand)AuthorFilesLines
2019-12-14tests: changes for scapy 2.4.3 migrationsnaramre1-1/+2
2019-11-15tests: Remove the unrequired VPP IP address/prefix class wrappersNeale Ranns1-5/+4
2019-11-08tests: python3 use byte strings in raw()Ole Troan1-3/+3
2019-11-05misc: Fix python scripts shebang lineRenato Botelho do Couto1-1/+1
2019-06-25tests: fix test_gbp.py.Paul Vinciguerra1-8/+24
2019-06-18fib: fib api updatesNeale Ranns1-7/+10
2019-04-11Tests: Refactor tearDown show command logging, add lifecycle markers.Paul Vinciguerra1-5/+6
2019-04-10Tests Cleanup: Fix missing calls to setUpClass/tearDownClass.Paul Vinciguerra1-0/+4
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-2/+2
2019-03-11vpp_papi_provider: Remove more wrapper functions.Ole Troan1-7/+10
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-18/+2
2018-09-12VXLAN-GBP: use common types on the APINeale Ranns1-10/+13
2018-09-10vxlan-gbp: Add support for vxlan gbpMohsin Kazmi1-0/+277
ght .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { 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 */ }
#!/usr/bin/env python3

import unittest

from framework import VppTestCase, VppTestRunner, running_gcov_tests
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath


class TestOffload(VppTestCase):
    """ Offload Unit Test Cases """

    @classmethod
    def setUpClass(cls):
        super(TestOffload, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(TestOffload, cls).tearDownClass()

    def setUp(self):
        super(TestOffload, self).setUp()

    def tearDown(self):
        super(TestOffload, self).tearDown()

    def test_offload_unittest(self):
        """ Checksum Offload Test """
        cmds = ["loop create",
                "set int ip address loop0 11.22.33.1/24",
                "set int state loop0 up",
                "loop create",
                "set int ip address loop1 11.22.34.1/24",
                "set int state loop1 up",
                "set ip neighbor loop1 11.22.34.44 03:00:11:22:34:44",
                "packet-generator new {\n"
                "  name s0\n"
                "  limit 100\n"
                "  size 128-128\n"
                "  interface loop0\n"
                "  tx-interface loop1\n"
                "  node loop1-output\n"
                "  buffer-flags ip4 offload\n"
                "  buffer-offload-flags offload-ip-cksum offload-udp-cksum\n"
                "  data {\n"
                "    IP4: 1.2.3 -> dead.0000.0001\n"
                "    UDP: 11.22.33.44 -> 11.22.34.44\n"
                "      ttl 2 checksum 13\n"
                "    UDP: 1234 -> 2345\n"
                "      checksum 11\n"
                "    incrementing 114\n"
                "  }\n"
                "}",
                "trace add pg-input 1",
                "pa en",
                "show error"]

        for cmd in cmds:
            r = self.vapi.cli_return_response(cmd)
            if r.retval != 0:
                if hasattr(r, 'reply'):
                    self.logger.info(cmd + " FAIL reply " + r.reply)
                else:
                    self.logger.info(cmd + " FAIL retval " + str(r.retval))

        r = self.vapi.cli_return_response("show trace")
        self.assertTrue(r.retval == 0)
        self.assertTrue(hasattr(r, 'reply'))
        rv = r.reply
        look_here = rv.find('ethernet-input')
        self.assertFalse(look_here == -1)
        bad_checksum_index = rv[look_here:].find('should be')
        self.assertTrue(bad_checksum_index == -1)

if __name__ == '__main__':
    unittest.main(testRunner=VppTestRunner)