diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2019-05-24 08:25:03 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-05-28 08:50:21 +0000 |
commit | f03becacfedc8a35d8cb711dcaf4fbeb5ba293cc (patch) | |
tree | bd174371956e57efc28c4bc7f6e73dbf16ca3512 /test | |
parent | 94e4531a02099eb017e84f42a1d5ed0a43c32dd0 (diff) |
gre: don't register gre input nodes unless a gre tunnel is created
Change-Id: Id5c0f420e32e0504cea660fed2013f3ad28088aa
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_gre.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/test_gre.py b/test/test_gre.py index 71117ad738c..7936334ba77 100644 --- a/test/test_gre.py +++ b/test/test_gre.py @@ -18,6 +18,52 @@ from util import ppp, ppc from vpp_papi import VppEnum +class TestGREInputNodes(VppTestCase): + """ GRE Input Nodes Test Case """ + + def setUp(self): + super(TestGREInputNodes, self).setUp() + + # create 3 pg interfaces - set one in a non-default table. + self.create_pg_interfaces(range(1)) + + for i in self.pg_interfaces: + i.admin_up() + i.config_ip4() + + def tearDown(self): + for i in self.pg_interfaces: + i.unconfig_ip4() + i.admin_down() + super(TestGREInputNodes, self).tearDown() + + def test_gre_input_node(self): + """ GRE gre input nodes not registerd unless configured """ + pkt = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) / + IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) / + GRE()) + + self.pg0.add_stream(pkt) + self.pg_start() + # no tunnel created, gre-input not registered + err = self.statistics.get_counter( + '/err/ip4-input/unknown ip protocol')[0] + self.assertEqual(err, 1) + err_count = err + + # create gre tunnel + gre_if = VppGreInterface(self, self.pg0.local_ip4, "1.1.1.2") + gre_if.add_vpp_config() + + self.pg0.add_stream(pkt) + self.pg_start() + # tunnel created, gre-input registered + err = self.statistics.get_counter( + '/err/ip4-input/unknown ip protocol')[0] + # expect no new errors + self.assertEqual(err, err_count) + + class TestGRE(VppTestCase): """ GRE Test Case """ |