aboutsummaryrefslogtreecommitdiffstats
path: root/tests/suites
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2016-07-22 09:50:03 +0200
committerMatej Klotton <mklotton@cisco.com>2016-07-22 09:15:23 +0000
commitdec1188c7f89f5f8f97085b5f68c6f1d918586b8 (patch)
tree95d79281e92cb5cd5a64dda10991d71d852664f9 /tests/suites
parent9c8743594ac51c51ac14b6b80c9806a79ada0753 (diff)
CSIT-219: Realocate resources for Honeycomb tests
- move the resources to resources/test_data/honeycomb Change-Id: I77c1bd5707f557799a7a189a9c695c50e5471621 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'tests/suites')
-rw-r--r--tests/suites/honeycomb/021_l2_fib.robot2
-rw-r--r--tests/suites/honeycomb/030_vxlan.robot2
-rw-r--r--tests/suites/honeycomb/031_vxlan_gpe.robot2
-rw-r--r--tests/suites/honeycomb/060_sub_interface.robot2
-rw-r--r--tests/suites/honeycomb/070_netconf.robot2
-rw-r--r--tests/suites/honeycomb/080_access_control_lists.robot2
-rw-r--r--tests/suites/honeycomb/resources/acl.py82
-rw-r--r--tests/suites/honeycomb/resources/l2_fib.py142
-rw-r--r--tests/suites/honeycomb/resources/netconf/hello.py22
-rw-r--r--tests/suites/honeycomb/resources/netconf/subscription.py24
-rw-r--r--tests/suites/honeycomb/resources/netconf/triggers.py336
-rw-r--r--tests/suites/honeycomb/resources/persistence.py138
-rw-r--r--tests/suites/honeycomb/resources/sub_interfaces.py287
-rw-r--r--tests/suites/honeycomb/resources/vxlan.py28
-rw-r--r--tests/suites/honeycomb/resources/vxlan_gpe.py99
15 files changed, 6 insertions, 1164 deletions
diff --git a/tests/suites/honeycomb/021_l2_fib.robot b/tests/suites/honeycomb/021_l2_fib.robot
index c994ad3b5b..ec07e104ad 100644
--- a/tests/suites/honeycomb/021_l2_fib.robot
+++ b/tests/suites/honeycomb/021_l2_fib.robot
@@ -16,7 +16,7 @@
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
| Resource | resources/libraries/robot/honeycomb/l2_fib.robot
-| Variables | tests/suites/honeycomb/resources/l2_fib.py
+| Variables | resources/test_data/honeycomb/l2_fib.py
| Documentation | *Honeycomb L2 FIB management test suite.*
| Suite Setup | Run keywords
| ... | Set test interface down
diff --git a/tests/suites/honeycomb/030_vxlan.robot b/tests/suites/honeycomb/030_vxlan.robot
index 03a3d71cd5..7e192cea47 100644
--- a/tests/suites/honeycomb/030_vxlan.robot
+++ b/tests/suites/honeycomb/030_vxlan.robot
@@ -30,7 +30,7 @@
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
| Resource | resources/libraries/robot/honeycomb/vxlan.robot
# import additional VxLAN settings from resource file
-| Variables | tests/suites/honeycomb/resources/vxlan.py
+| Variables | resources/test_data/honeycomb/vxlan.py
| Force Tags | honeycomb_sanity
| Documentation | *Honeycomb VxLAN management test suite.*
| ...
diff --git a/tests/suites/honeycomb/031_vxlan_gpe.robot b/tests/suites/honeycomb/031_vxlan_gpe.robot
index ec2ef3a518..5c51319070 100644
--- a/tests/suites/honeycomb/031_vxlan_gpe.robot
+++ b/tests/suites/honeycomb/031_vxlan_gpe.robot
@@ -36,7 +36,7 @@
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
| Resource | resources/libraries/robot/honeycomb/vxlan_gpe.robot
# Import additional VxLAN GPE settings from resource file
-| Variables | tests/suites/honeycomb/resources/vxlan_gpe.py
+| Variables | resources/test_data/honeycomb/vxlan_gpe.py
| Documentation | *Honeycomb VxLAN-GPE management test suite.*
| Force Tags | honeycomb_sanity
diff --git a/tests/suites/honeycomb/060_sub_interface.robot b/tests/suites/honeycomb/060_sub_interface.robot
index 595bbde2b7..e67638ab97 100644
--- a/tests/suites/honeycomb/060_sub_interface.robot
+++ b/tests/suites/honeycomb/060_sub_interface.robot
@@ -16,7 +16,7 @@
| Resource | resources/libraries/robot/honeycomb/sub_interface.robot
| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
-| Variables | tests/suites/honeycomb/resources/sub_interfaces.py
+| Variables | resources/test_data/honeycomb/sub_interfaces.py
| Suite Teardown | Honeycomb removes all bridge domains | ${node}
| Force Tags | honeycomb_sanity
| Documentation | *Honeycomb sub-interface management test suite.*
diff --git a/tests/suites/honeycomb/070_netconf.robot b/tests/suites/honeycomb/070_netconf.robot
index 998b550bf6..9925dee15f 100644
--- a/tests/suites/honeycomb/070_netconf.robot
+++ b/tests/suites/honeycomb/070_netconf.robot
@@ -14,7 +14,7 @@
*** Settings ***
| Resource | resources/libraries/robot/default.robot
| Resource | resources/libraries/robot/honeycomb/netconf.robot
-| Variables | tests/suites/honeycomb/resources/netconf/triggers.py
+| Variables | resources/test_data/honeycomb/netconf/triggers.py
| Documentation | *Netconf test suite. Contains test cases that need to bypass\
| ... | REST API.*
| Force Tags | honeycomb_sanity
diff --git a/tests/suites/honeycomb/080_access_control_lists.robot b/tests/suites/honeycomb/080_access_control_lists.robot
index 84dc42ee75..146a02edd3 100644
--- a/tests/suites/honeycomb/080_access_control_lists.robot
+++ b/tests/suites/honeycomb/080_access_control_lists.robot
@@ -18,7 +18,7 @@
*** Settings ***
| Resource | resources/libraries/robot/default.robot
| Resource | resources/libraries/robot/honeycomb/access_control_lists.robot
-| Variables | tests/suites/honeycomb/resources/acl.py
+| Variables | resources/test_data/honeycomb/acl.py
| Suite Teardown | Clear all ACL settings | ${node}
| Documentation | *Honeycomb access control lists test suite.*
| Force Tags | Honeycomb_sanity
diff --git a/tests/suites/honeycomb/resources/acl.py b/tests/suites/honeycomb/resources/acl.py
deleted file mode 100644
index 227330c2a9..0000000000
--- a/tests/suites/honeycomb/resources/acl.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for access control list test suite."""
-
-# settings for acl tables
-hc_acl_table = {
- "name": "acl_table_test",
- "nbuckets": 1,
- "memory_size": 100000,
- "skip_n_vectors": 0,
- "miss_next": "permit",
- "mask": "00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:00:00:00:00"
-}
-
-hc_acl_table2 = {
- "name": "acl_table_test2",
- "nbuckets": 2,
- "memory_size": 100000,
- "skip_n_vectors": 1,
- "next_table": "acl_table_test",
- "miss_next": "deny",
- "mask": "ff:ff:ff:00:00:00:ff:ff:ff:ff:ff:ff:00:00:00:00"
-}
-# representation of table settings in VAT
-table_index = 0
-vat_acl_table = {
- "nbuckets": hc_acl_table['nbuckets'],
- "skip": 0,
- "match": 1,
- "nextnode": -1,
- "nexttbl": -1,
- "mask": hc_acl_table['mask'].replace(":", ""),
-}
-table_index2 = 1
-vat_acl_table2 = {
- "nbuckets": hc_acl_table2['nbuckets'],
- "skip": 1,
- "match": 1,
- "nextnode": 0,
- "nexttbl": table_index,
- "mask": hc_acl_table2['mask'].replace(":", ""),
-}
-# setting for acl sessions
-hc_acl_session = {
- "match": "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00",
- "hit_next": "permit",
- "opaque_index": "1",
- "advance": 1
-}
-
-hc_acl_session2 = {
- "match": "00:00:00:00:00:00:06:05:04:03:02:01:00:00:00:00",
- "hit_next": "deny",
- "opaque_index": "2",
- "advance": 1
-}
-# representation of session settings in VAT
-session_index = 0
-vat_acl_session = {
- "match": hc_acl_session['match'].replace(":", ""),
- "advance": hc_acl_session['advance'],
- "opaque": 1,
- "next_index": -1
-}
-session_index2 = 1
-vat_acl_session2 = {
- "match": hc_acl_session2['match'].replace(":", ""),
- "advance": hc_acl_session2['advance'],
- "opaque": 2,
- "next_index": session_index
-}
diff --git a/tests/suites/honeycomb/resources/l2_fib.py b/tests/suites/honeycomb/resources/l2_fib.py
deleted file mode 100644
index b06193ad1d..0000000000
--- a/tests/suites/honeycomb/resources/l2_fib.py
+++ /dev/null
@@ -1,142 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for Honeycomb L2 FIB test suite."""
-
-# Bridge domain name.
-bd_name = 'test-l2-bd'
-bd_index = 1
-
-# Bridge domain settings used while creating a test bridge domain.
-bd_settings = {
- 'flood': True,
- 'forward': True,
- 'learn': True,
- 'unknown-unicast-flood': True,
- 'arp-termination': True
-}
-
-# Bridge domain configuration used while adding the bridge domain to an
-# interface.
-if_bd_settings = {
- 'bridge-domain': bd_name,
- 'split-horizon-group': 1,
- 'bridged-virtual-interface': False
-}
-
-# Add L2 FIB entry (forward).
-# Configuration data:
-l2_fib_forward_cfg = {
- "phys-address": "aa:bb:cc:dd:ee:ff",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "action": "l2-fib-forward"
-}
-
-# Expected operational data:
-l2_fib_forward_oper = {
- "phys-address": "aa:bb:cc:dd:ee:ff",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "bridged-virtual-interface": False,
- "action": "v3po:l2-fib-forward",
- "static-config": False
-}
-
-# Expected VAT data:
-l2_fib_forward_vat = {
- "mac": int("".join(l2_fib_forward_oper["phys-address"].split(':')), 16),
- "static_mac": 0,
- "filter_mac": 0,
- "bvi_mac": 0
- }
-
-# Add L2 FIB entry (static, forward).
-# Configuration data:
-l2_fib_static_forward_cfg = {
- "phys-address": "22:22:33:44:55:66",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "static-config": True,
- "action": "l2-fib-forward"
-}
-
-# Expected operational data:
-l2_fib_static_forward_oper = {
- "phys-address": "22:22:33:44:55:66",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "bridged-virtual-interface": False,
- "action": "v3po:l2-fib-forward",
- "static-config": True
-}
-
-# Expected VAT data:
-l2_fib_static_forward_vat = {
- "mac": int("".join(l2_fib_static_forward_oper["phys-address"].
- split(':')), 16),
- "sw_if_index": 5,
- "static_mac": 1,
- "filter_mac": 0,
- "bvi_mac": 0
-}
-
-# Add L2 FIB entry (filter).
-# Configuration data:
-l2_fib_filter_cfg = {
- "phys-address": "00:01:02:03:04:05",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "static-config": True,
- "action": "l2-fib-filter"
-}
-
-# Expected operational data:
-l2_fib_filter_oper = {
- "phys-address": "00:01:02:03:04:05",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "bridged-virtual-interface": False,
- "action": "v3po:l2-fib-filter",
- "static-config": True
-}
-
-# Expected VAT data:
-l2_fib_filter_vat = {
- "mac": int("".join(l2_fib_filter_oper["phys-address"].split(':')), 16),
- "sw_if_index": 5,
- "static_mac": 1,
- "filter_mac": 1,
- "bvi_mac": 0
-}
-
-# WRONG configuration data - Add L2 FIB entry.
-l2_fib_forward_cfg_wrong_mac = {
- "phys-address": "WRONG-MAC",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "action": "l2-fib-forward"
-}
-
-l2_fib_forward_cfg_wrong_if = {
- "phys-address": "aa:bb:cc:dd:ee:ff",
- "outgoing-interface": "WRONG-INTERFACE",
- "action": "l2-fib-forward"
-}
-
-l2_fib_forward_cfg_wrong_action = {
- "phys-address": "aa:bb:cc:dd:ee:ff",
- "outgoing-interface": "GigabitEthernet0/8/0",
- "action": "WRONG-ACTION"
-}
-
-# Modify L2 FIB entry (forward).
-# Configuration data:
-l2_fib_forward_modified_cfg = {
- "phys-address": "aa:bb:cc:dd:ee:ff",
- "outgoing-interface": "GigabitEthernet0/9/0",
- "action": "l2-fib-forward"
-}
diff --git a/tests/suites/honeycomb/resources/netconf/hello.py b/tests/suites/honeycomb/resources/netconf/hello.py
deleted file mode 100644
index 2cc89b387c..0000000000
--- a/tests/suites/honeycomb/resources/netconf/hello.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Hello message with capabilities list for Netconf sessions."""
-
-hello = u"""
-<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<capabilities>
-<capability>urn:ietf:params:netconf:base:1.0</capability>
-</capabilities>
-</hello>
-]]>]]>""" \ No newline at end of file
diff --git a/tests/suites/honeycomb/resources/netconf/subscription.py b/tests/suites/honeycomb/resources/netconf/subscription.py
deleted file mode 100644
index ccf8c47022..0000000000
--- a/tests/suites/honeycomb/resources/netconf/subscription.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""RPC call to add a subscription to Netconf notifications."""
-
-subscription = u"""
-<netconf:rpc netconf:message-id="101"
-xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
-<create-subscription
-xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
-<stream>honeycomb</stream>
-</create-subscription>
-</netconf:rpc>
-]]>]]>"""
diff --git a/tests/suites/honeycomb/resources/netconf/triggers.py b/tests/suites/honeycomb/resources/netconf/triggers.py
deleted file mode 100644
index 77596bd052..0000000000
--- a/tests/suites/honeycomb/resources/netconf/triggers.py
+++ /dev/null
@@ -1,336 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Contains RPC sequences to trigger specific issues through Netconf."""
-
-# Test data for issue: https://jira.fd.io/browse/HONEYCOMB-105
-# Creating and removing interfaces may result in duplicated interface indices.
-trigger_105 = u"""
-<rpc message-id="m-27" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<get-config>
-<source>
-<running/>
-</source>
-<filter xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:type="subtree">
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface>
-<name>4fe335c8-6fdc-4654-b12c-d256e9b39229</name>
-</interface>
-</interfaces>
-</filter>
-</get-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-38" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="replace">
-<name>4fe335c8-6fdc-4654-b12c-d256e9b39229</name>
-<description>neutron port</description>
-<link-up-down-trap-enable>enabled</link-up-down-trap-enable>
-<vhost-user xmlns="urn:opendaylight:params:xml:ns:yang:v3po">
-<role>client</role>
-<socket>/tmp/socket_4fe335c8-6fdc-4654-b12c-d256e9b39229</socket>
-</vhost-user>
-<type xmlns:x="urn:opendaylight:params:xml:ns:yang:v3po">x:vhost-user</type>
-<enabled>true</enabled>
-</interface>
-</interfaces>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-43" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="delete">
-<name>4fe335c8-6fdc-4654-b12c-d256e9b39229</name>
-</interface>
-</interfaces>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-50" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="replace">
-<name>4fe335c8-6fdc-4654-b12c-d256e9b39229</name>
-<description>neutron port</description>
-<link-up-down-trap-enable>enabled</link-up-down-trap-enable>
-<vhost-user xmlns="urn:opendaylight:params:xml:ns:yang:v3po">
-<role>client</role>
-<socket>/tmp/socket_4fe335c8-6fdc-4654-b12c-d256e9b39229</socket>
-</vhost-user>
-<type xmlns:x="urn:opendaylight:params:xml:ns:yang:v3po">x:vhost-user</type>
-<enabled>true</enabled>
-</interface>
-</interfaces>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-57" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="replace">
-<name>d7611278-88ff-40e1-81e2-602e94e96fc7</name>
-<description>neutron port</description>
-<link-up-down-trap-enable>enabled</link-up-down-trap-enable>
-<vhost-user xmlns="urn:opendaylight:params:xml:ns:yang:v3po">
-<role>client</role>
-<socket>/tmp/socket_d7611278-88ff-40e1-81e2-602e94e96fc7</socket>
-</vhost-user>
-<type xmlns:x="urn:opendaylight:params:xml:ns:yang:v3po">x:vhost-user</type>
-<enabled>true</enabled>
-</interface>
-</interfaces>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
-<interface xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="replace">
-<name>1f96a665-4351-4984-b1a8-dc6f54683123</name>
-<description>neutron port</description>
-<link-up-down-trap-enable>enabled</link-up-down-trap-enable>
-<vhost-user xmlns="urn:opendaylight:params:xml:ns:yang:v3po">
-<role>client</role>
-<socket>/tmp/socket_1f96a665-4351-4984-b1a8-dc6f54683123</socket>
-</vhost-user>
-<type xmlns:x="urn:opendaylight:params:xml:ns:yang:v3po">x:vhost-user</type>
-<enabled>true</enabled>
-</interface>
-</interfaces>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<edit-config>
-<target>
-<candidate/>
-</target>
-<default-operation>none</default-operation>
-<config>
-<vpp xmlns="urn:opendaylight:params:xml:ns:yang:v3po">
-<bridge-domains>
-<bridge-domain xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0"
-a:operation="replace">
-<name>e86740a2-042c-4e64-a43b-cc224e0d5240</name>
-<unknown-unicast-flood>true</unknown-unicast-flood>
-<forward>true</forward>
-<learn>true</learn>
-<flood>true</flood>
-<arp-termination>false</arp-termination>
-</bridge-domain>
-</bridge-domains>
-</vpp>
-</config>
-</edit-config>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-80" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<commit/>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-74" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<unlock>
-<target>
-<candidate/>
-</target>
-</unlock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-72" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<lock>
-<target>
-<candidate/>
-</target>
-</lock>
-</rpc>
-]]>]]>
-
-<rpc message-id="m-75" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-<get>
-<filter xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:type="subtree">
-<interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"/>
-</filter>
-</get>
-</rpc>
-]]>]]>"""
diff --git a/tests/suites/honeycomb/resources/persistence.py b/tests/suites/honeycomb/resources/persistence.py
deleted file mode 100644
index f46cfba597..0000000000
--- a/tests/suites/honeycomb/resources/persistence.py
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for Honeycomb persistence test suite."""
-
-
-def get_variables(interface):
- """Creates and returns dictionary of test variables.
-
- :param interface: name of super-interface for the tested sub-interface
- :type interface: str
- :return: dictionary of test variables
- :rtype: dict
- """
- # basic settings
- bd_name = 'bd_persist'
- sub_if_id = 1
- sub_if_name = interface + '.' + str(sub_if_id)
-
- variables = {
- # VxLan settings
- 'vx_interface': 'vx_tunnel_test',
- 'vxlan_settings': {'src': '192.168.0.2',
- 'dst': '192.168.0.3',
- "vni": 88,
- 'encap-vrf-id': 0},
- # bridge domain settings
- 'bd_name': bd_name,
- 'bd_settings': {'flood': True,
- 'forward': True,
- 'learn': True,
- 'unknown-unicast-flood': True,
- 'arp-termination': True
- },
- # tap interface settings
- 'tap_interface': 'tap_test',
- 'tap_settings': {'tap-name': 'tap_test',
- 'mac': '08:00:27:c0:5d:37',
- 'device-instance': 1
- },
- # vhost-user interface settings
- 'vhost_interface': 'test_vhost',
- 'vhost_user_server': {'socket': 'soc1',
- 'role': 'server'
- },
- # Vlan subinterface settings
- 'sub_if_id': sub_if_id,
- 'sub_if_name': sub_if_name,
- 'sub_if_1_settings': {
- "identifier": sub_if_id,
- "vlan-type": "802dot1q",
- "enabled": "false"
- },
- 'sub_if_1_tags': [
- {
- "index": "0",
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": "100"
- }
- },
- {
- "index": "1",
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": "any"
- }
- }
- ],
- 'sub_if_1_match': "vlan-tagged-exact-match",
- 'sub_if_1_oper': {
- "identifier": sub_if_id,
- "oper-status": "up",
- "admin-status": "up",
- "tags": {
- "tag": [
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": "any"
- }
- },
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": "100"
- }
- }
- ]
- },
- "match": {
- "vlan-tagged": {
- "match-exact-tags": False
- }
- }
- },
- 'sub_bd_settings': {
- 'bridge-domain': bd_name,
- 'split-horizon-group': '1',
- 'bridged-virtual-interface': 'False'
- },
- 'tag_rewrite_pop_1': {
- "pop-tags": "1"
- },
-
- 'tag_rewrite_pop_1_oper': {
- "vlan-type": "vpp-vlan:802dot1ad",
- "pop-tags": 1
- },
-
- 'tag_rewrite_pop_1_VAT': {
- 'sub_default': 0,
- 'sub_dot1ad': 0,
- 'sub_exact_match': 0,
- 'sub_inner_vlan_id': 0,
- 'sub_inner_vlan_id_any': 1,
- 'sub_number_of_tags': 2,
- 'sub_outer_vlan_id': 100,
- 'sub_outer_vlan_id_any': 0,
- 'vtr_op': 3,
- 'vtr_push_dot1q': 0,
- 'vtr_tag1': 0,
- 'vtr_tag2': 0
- }
- }
- return variables
diff --git a/tests/suites/honeycomb/resources/sub_interfaces.py b/tests/suites/honeycomb/resources/sub_interfaces.py
deleted file mode 100644
index 6904b48015..0000000000
--- a/tests/suites/honeycomb/resources/sub_interfaces.py
+++ /dev/null
@@ -1,287 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for Honeycomb sub-interface test suite."""
-
-# Sub-interface 1 and its settings:
-sub_if_1_settings = {
- "identifier": "1",
- "vlan-type": "802dot1q",
- "enabled": "false"
-}
-
-sub_if_1_tags = [
- {
- "index": "0",
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": "100"
- }
- },
- {
- "index": "1",
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": "any"
- }
- }
-]
-
-sub_if_1_match = "vlan-tagged-exact-match"
-
-# Expected operational data: sub-interface.
-sub_if_1_oper = {
- "identifier": 1,
- "oper-status": "down",
- "admin-status": "down",
- "tags": {
- "tag": [
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": "any"
- }
- },
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": "100"
- }
- }
- ]
- },
- "match": {
- "vlan-tagged": {
- "match-exact-tags": False
- }
- }
-}
-
-# Bridge domain name.
-bd_name = 'test-sub-bd'
-
-# Bridge domain settings used while creating a test bridge domain.
-bd_settings = {
- 'flood': True,
- 'forward': True,
- 'learn': True,
- 'unknown-unicast-flood': True,
- 'arp-termination': True
-}
-
-# Bridge domain configuration used while adding the sub-interface to the bridge
-# domain.
-sub_bd_settings = {
- 'bridge-domain': bd_name,
- 'split-horizon-group': 1,
- 'bridged-virtual-interface': False
-}
-
-# Configuration data: Enable tag-rewrite push.
-tag_rewrite_push = {
- "vlan-type": "vpp-vlan:802dot1q",
- "push-tags": [
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id":123
- }
- },
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": 456
- }
- }
- ]
-}
-
-# Expected operational data: tag-rewrite push.
-tag_rewrite_push_oper = {
- "vlan-type": "vpp-vlan:802dot1q",
- "push-tags": [
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": 456
- }
- },
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": 123
- }
- }
- ]
-}
-
-# Expected VAT data: tag-rewrite push.
-tag_rewrite_push_VAT = {
- 'sub_default': 0,
- 'sub_dot1ad': 0,
- 'sub_exact_match': 0,
- 'sub_inner_vlan_id': 0,
- 'sub_inner_vlan_id_any': 1,
- 'sub_number_of_tags': 2,
- 'sub_outer_vlan_id': 100,
- 'sub_outer_vlan_id_any': 0,
- 'vtr_op': 2,
- 'vtr_push_dot1q': 1,
- 'vtr_tag1': 123,
- 'vtr_tag2': 456
-}
-
-# Configuration data: Enable tag-rewrite pop 1.
-tag_rewrite_pop_1 = {
- "pop-tags": "1"
-}
-
-# Expected operational data: tag-rewrite pop 1.
-tag_rewrite_pop_1_oper = {
- "vlan-type": "vpp-vlan:802dot1ad",
- "pop-tags": 1
-}
-
-# Expected VAT data: tag-rewrite pop 1.
-tag_rewrite_pop_1_VAT = {
- 'sub_default': 0,
- 'sub_dot1ad': 0,
- 'sub_exact_match': 0,
- 'sub_inner_vlan_id': 0,
- 'sub_inner_vlan_id_any': 1,
- 'sub_number_of_tags': 2,
- 'sub_outer_vlan_id': 100,
- 'sub_outer_vlan_id_any': 0,
- 'vtr_op': 3,
- 'vtr_push_dot1q': 0,
- 'vtr_tag1': 0,
- 'vtr_tag2': 0
-}
-
-# Configuration data: Enable tag-rewrite translate 1-2.
-tag_rewrite_translate_1_2 = {
- "vlan-type": "vpp-vlan:802dot1q",
- "pop-tags": "1",
- "push-tags": [
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": 111
- }
- },
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": 222
- }
- }
- ]
-}
-
-# Expected operational data: tag-rewrite translate 1-2.
-tag_rewrite_translate_1_2_oper = {
- "vlan-type": "vpp-vlan:802dot1q",
- "pop-tags": 1,
- "push-tags": [
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": 222
- }
- },
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": 111
- }
- }
- ]
-}
-
-# Expected VAT data: tag-rewrite translate 1-2.
-tag_rewrite_translate_1_2_VAT = {
- 'sub_default': 0,
- 'sub_dot1ad': 0,
- 'sub_exact_match': 0,
- 'sub_inner_vlan_id': 0,
- 'sub_inner_vlan_id_any': 1,
- 'sub_number_of_tags': 2,
- 'sub_outer_vlan_id': 100,
- 'sub_outer_vlan_id_any': 0,
- 'vtr_op': 6,
- 'vtr_push_dot1q': 1,
- 'vtr_tag1': 111,
- 'vtr_tag2': 222
-}
-
-# Configuration data: Disable tag-rewrite.
-tag_rewrite_disabled = {}
-
-# Expected VAT data: Disable tag-rewrite.
-tag_rewrite_disabled_VAT = {
- 'sub_default': 0,
- 'sub_dot1ad': 0,
- 'sub_exact_match': 0,
- 'sub_inner_vlan_id': 0,
- 'sub_inner_vlan_id_any': 1,
- 'sub_number_of_tags': 2,
- 'sub_outer_vlan_id': 100,
- 'sub_outer_vlan_id_any': 0,
- 'vtr_op': 0,
- 'vtr_push_dot1q': 0,
- 'vtr_tag1': 0,
- 'vtr_tag2': 0
-}
-
-# Configuration data:
-# Wrong vlan-type for enable tag-rewrite translate 1-2.
-tag_rewrite_translate_1_2_wrong = {
- "vlan-type": "vpp-vlan:WRONG",
- "pop-tags": "1",
- "push-tags": [
- {
- "index": 0,
- "dot1q-tag": {
- "tag-type": "dot1q-types:s-vlan",
- "vlan-id": 111
- }
- },
- {
- "index": 1,
- "dot1q-tag": {
- "tag-type": "dot1q-types:c-vlan",
- "vlan-id": 222
- }
- }
- ]
-}
-
-# IP addresses configured on sub-interface during tests
-ipv4 = {
- "address": "192.168.0.4",
- "netmask": "255.255.255.0",
- "prefix-length": 24}
-ipv4_2 = {
- "address": "192.168.0.5",
- "netmask": "255.255.0.0",
- "prefix-length": 16}
diff --git a/tests/suites/honeycomb/resources/vxlan.py b/tests/suites/honeycomb/resources/vxlan.py
deleted file mode 100644
index 43307aa61a..0000000000
--- a/tests/suites/honeycomb/resources/vxlan.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for Honeycomb VxLAN management test suite."""
-
-# invalid VxLAN settings
-vxlan_invalid = [
- # same source and destination IPs
- {'src': '192.168.0.2', 'dst': '192.168.0.2', 'vni': 88, 'encap-vrf-id': 0},
- # missing source
- {'dst': '192.168.0.2', 'vni': 88, 'encap-vrf-id': 0},
- # missing destination
- {'src': '192.168.0.2', 'vni': 88, 'encap-vrf-id': 0},
- # missing vni
- {'src': '192.168.0.2', 'dst': '192.168.0.3', 'encap-vrf-id': 0},
- # missing encap id
- {'src': '192.168.0.2', 'dst': '192.168.0.3', 'vni': 88}
-]
diff --git a/tests/suites/honeycomb/resources/vxlan_gpe.py b/tests/suites/honeycomb/resources/vxlan_gpe.py
deleted file mode 100644
index 308cd0a316..0000000000
--- a/tests/suites/honeycomb/resources/vxlan_gpe.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# 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.
-
-"""Test variables for Honeycomb VxLAN GPE management test suite."""
-
-# The first VxLAN GPE Interface used in tests.
-vxlan_gpe_if1 = 'vxlan_gpe_tunnel0'
-vxlan_gpe_base_settings = {
- 'name': vxlan_gpe_if1,
- 'description': 'for testing purposes',
- 'enabled': True,
- 'link-up-down-trap-enable': 'enabled'
-}
-vxlan_gpe_settings = {
- 'local': '192.168.50.76',
- 'remote': '192.168.50.71',
- 'vni': 9,
- 'next-protocol': 'ipv4',
- 'encap-vrf-id': 0,
- 'decap-vrf-id': 0
-}
-
-# The values of parameters of disabled VxLAN GPE interface.
-vxlan_gpe_disabled_base_settings = {
- 'name': vxlan_gpe_if1,
- 'description': 'for testing purposes',
- 'enabled': 'false'
-}
-
-# Wrong interface type.
-vxlan_gpe_if2 = 'vxlan_gpe_tunnel1'
-vxlan_gpe_wrong_type_base_settings = {
- 'name': vxlan_gpe_if2,
- 'type': 'iana-if-type:ethernetCsmacd',
- 'description': 'for testing purposes',
- 'enabled': True,
- 'link-up-down-trap-enable': 'enabled'
-}
-
-# Wrong next-protocol value.
-vxlan_gpe_if3 = 'vxlan_gpe_tunnel1'
-vxlan_gpe_wrong_protocol_base_settings = {
- 'name': vxlan_gpe_if3,
- 'description': 'for testing purposes',
- 'enabled': 'true',
- 'link-up-down-trap-enable': 'enabled'
-}
-vxlan_gpe_wrong_protocol_settings = {
- 'local': '192.168.50.77',
- 'remote': '192.168.50.72',
- 'vni': 9,
- 'next-protocol': 'wrong_ipv4',
- 'encap-vrf-id': 0,
- 'decap-vrf-id': 0
-}
-
-# The first IPv6 VxLAN GPE interface.
-vxlan_gpe_if5 = 'vxlan_gpe_tunnel0'
-vxlan_gpe_base_ipv6_settings = {
- 'name': vxlan_gpe_if5,
- 'description': 'for testing purposes',
- 'enabled': True,
- 'link-up-down-trap-enable': 'enabled'
-}
-vxlan_gpe_ipv6_settings = {
- 'local': '10:10:10:10:10:10:10:10',
- 'remote': '10:10:10:10:10:10:10:11',
- 'vni': 9,
- 'next-protocol':'ipv4',
- 'encap-vrf-id': 0,
- 'decap-vrf-id': 0
-}
-
-# The second IPv6 VxLAN GPE interface.
-vxlan_gpe_if6 = 'vxlan_gpe_tunnel1'
-vxlan_gpe_base_ipv6_settings2 = {
- 'name': vxlan_gpe_if6,
- 'description': 'for testing purposes',
- 'enabled': True,
- 'link-up-down-trap-enable': 'enabled'
-}
-vxlan_gpe_ipv6_settings2 = {
- 'local': '10:10:10:10:10:10:10:20',
- 'remote': '10:10:10:10:10:10:10:21',
- 'vni': 9,
- 'next-protocol': 'ipv4',
- 'encap-vrf-id': 0,
- 'decap-vrf-id': 0
-}
t_from = self.tcp_dport_from_2 dport_to = self.tcp_dport_to_2 elif proto == self.proto[self.IP][self.UDP]: sport_from = self.udp_sport_from_2 sport_to = self.udp_sport_to_2 dport_from = self.udp_dport_from_2 dport_to = self.udp_dport_to_2 else: sport_from = ports sport_to = ports dport_from = ports dport_to = ports rule = ({'is_permit': permit_deny, 'is_ipv6': ip, 'proto': proto, 'srcport_or_icmptype_first': sport_from, 'srcport_or_icmptype_last': sport_to, 'src_ip_prefix_len': s_prefix, 'src_ip_addr': s_ip, 'dstport_or_icmpcode_first': dport_from, 'dstport_or_icmpcode_last': dport_to, 'dst_ip_prefix_len': d_prefix, 'dst_ip_addr': d_ip}) return rule def apply_rules(self, rules, tag=''): reply = self.vapi.acl_add_replace(acl_index=4294967295, r=rules, tag=tag) self.logger.info("Dumped ACL: " + str( self.vapi.acl_dump(reply.acl_index))) # Apply a ACL on the interface as inbound for i in self.pg_interfaces: self.vapi.acl_interface_set_acl_list(sw_if_index=i.sw_if_index, n_input=1, acls=[reply.acl_index]) return def apply_rules_to(self, rules, tag='', sw_if_index=0xFFFFFFFF): reply = self.vapi.acl_add_replace(acl_index=4294967295, r=rules, tag=tag) self.logger.info("Dumped ACL: " + str( self.vapi.acl_dump(reply.acl_index))) # Apply a ACL on the interface as inbound self.vapi.acl_interface_set_acl_list(sw_if_index=sw_if_index, n_input=1, acls=[reply.acl_index]) return def etype_whitelist(self, whitelist, n_input): # Apply whitelists on all the interfaces for i in self.pg_interfaces: # checkstyle can't read long names. Help them. fun = self.vapi.acl_interface_set_etype_whitelist fun(sw_if_index=i.sw_if_index, n_input=n_input, whitelist=whitelist) return def create_upper_layer(self, packet_index, proto, ports=0): p = self.proto_map[proto] if p == 'UDP': if ports == 0: return UDP(sport=random.randint(self.udp_sport_from, self.udp_sport_to), dport=random.randint(self.udp_dport_from, self.udp_dport_to)) else: return UDP(sport=ports, dport=ports) elif p == 'TCP': if ports == 0: return TCP(sport=random.randint(self.tcp_sport_from, self.tcp_sport_to), dport=random.randint(self.tcp_dport_from, self.tcp_dport_to)) else: return TCP(sport=ports, dport=ports) return '' def create_stream(self, src_if, packet_sizes, traffic_type=0, ipv6=0, proto=-1, ports=0, fragments=False, pkt_raw=True, etype=-1): """ Create input packet stream for defined interface using hosts or deleted_hosts list. :param object src_if: Interface to create packet stream for. :param list packet_sizes: List of required packet sizes. :param traffic_type: 1: ICMP packet, 2: IPv6 with EH, 0: otherwise. :return: Stream of packets. """ pkts = [] if self.flows.__contains__(src_if): src_hosts = self.hosts_by_pg_idx[src_if.sw_if_index] for dst_if in self.flows[src_if]: dst_hosts = self.hosts_by_pg_idx[dst_if.sw_if_index] n_int = len(dst_hosts) * len(src_hosts) for i in range(0, n_int): dst_host = dst_hosts[i / len(src_hosts)] src_host = src_hosts[i % len(src_hosts)] pkt_info = self.create_packet_info(src_if, dst_if) if ipv6 == 1: pkt_info.ip = 1 elif ipv6 == 0: pkt_info.ip = 0 else: pkt_info.ip = random.choice([0, 1]) if proto == -1: pkt_info.proto = random.choice(self.proto[self.IP]) else: pkt_info.proto = proto payload = self.info_to_payload(pkt_info) p = Ether(dst=dst_host.mac, src=src_host.mac) if etype > 0: p = Ether(dst=dst_host.mac, src=src_host.mac, type=etype) if pkt_info.ip: p /= IPv6(dst=dst_host.ip6, src=src_host.ip6) if fragments: p /= IPv6ExtHdrFragment(offset=64, m=1) else: if fragments: p /= IP(src=src_host.ip4, dst=dst_host.ip4, flags=1, frag=64) else: p /= IP(src=src_host.ip4, dst=dst_host.ip4) if traffic_type == self.ICMP: if pkt_info.ip: p /= ICMPv6EchoRequest(type=self.icmp6_type, code=self.icmp6_code) else: p /= ICMP(type=self.icmp4_type, code=self.icmp4_code) else: p /= self.create_upper_layer(i, pkt_info.proto, ports) if pkt_raw: p /= Raw(payload) pkt_info.data = p.copy() if pkt_raw: size = random.choice(packet_sizes) self.extend_packet(p, size) pkts.append(p) return pkts def verify_capture(self, pg_if, capture, traffic_type=0, ip_type=0, etype=-1): """ Verify captured input packet stream for defined interface. :param object pg_if: Interface to verify captured packet stream for. :param list capture: Captured packet stream. :param traffic_type: 1: ICMP packet, 2: IPv6 with EH, 0: otherwise. """ last_info = dict() for i in self.pg_interfaces: last_info[i.sw_if_index] = None dst_sw_if_index = pg_if.sw_if_index for packet in capture: if etype > 0: if packet[Ether].type != etype: self.logger.error(ppp("Unexpected ethertype in packet:", packet)) else: continue try: # Raw data for ICMPv6 are stored in ICMPv6EchoRequest.data if traffic_type == self.ICMP and ip_type == self.IPV6: payload_info = self.payload_to_info( packet[ICMPv6EchoRequest].data) payload = packet[ICMPv6EchoRequest] else: payload_info = self.payload_to_info(str(packet[Raw])) payload = packet[self.proto_map[payload_info.proto]] except: self.logger.error(ppp("Unexpected or invalid packet " "(outside network):", packet)) raise if ip_type != 0: self.assertEqual(payload_info.ip, ip_type) if traffic_type == self.ICMP: try: if payload_info.ip == 0: self.assertEqual(payload.type, self.icmp4_type) self.assertEqual(payload.code, self.icmp4_code) else: self.assertEqual(payload.type, self.icmp6_type) self.assertEqual(payload.code, self.icmp6_code) except: self.logger.error(ppp("Unexpected or invalid packet " "(outside network):", packet)) raise else: try: ip_version = IPv6 if payload_info.ip == 1 else IP ip = packet[ip_version] packet_index = payload_info.index self.assertEqual(payload_info.dst, dst_sw_if_index) self.logger.debug("Got packet on port %s: src=%u (id=%u)" % (pg_if.name, payload_info.src, packet_index)) next_info = self.get_next_packet_info_for_interface2( payload_info.src, dst_sw_if_index, last_info[payload_info.src]) last_info[payload_info.src] = next_info self.assertTrue(next_info is not None) self.assertEqual(packet_index, next_info.index) saved_packet = next_info.data # Check standard fields self.assertEqual(ip.src, saved_packet[ip_version].src) self.assertEqual(ip.dst, saved_packet[ip_version].dst) p = self.proto_map[payload_info.proto] if p == 'TCP': tcp = packet[TCP] self.assertEqual(tcp.sport, saved_packet[ TCP].sport) self.assertEqual(tcp.dport, saved_packet[ TCP].dport) elif p == 'UDP': udp = packet[UDP] self.assertEqual(udp.sport, saved_packet[ UDP].sport) self.assertEqual(udp.dport, saved_packet[ UDP].dport) except: self.logger.error(ppp("Unexpected or invalid packet:", packet)) raise for i in self.pg_interfaces: remaining_packet = self.get_next_packet_info_for_interface2( i, dst_sw_if_index, last_info[i.sw_if_index]) self.assertTrue( remaining_packet is None, "Port %u: Packet expected from source %u didn't arrive" % (dst_sw_if_index, i.sw_if_index)) def run_traffic_no_check(self): # Test # Create incoming packet streams for packet-generator interfaces for i in self.pg_interfaces: if self.flows.__contains__(i): pkts = self.create_stream(i, self.pg_if_packet_sizes) if len(pkts) > 0: i.add_stream(pkts) # Enable packet capture and start packet sending self.pg_enable_capture(self.pg_interfaces) self.pg_start() def run_verify_test(self, traffic_type=0, ip_type=0, proto=-1, ports=0, frags=False, pkt_raw=True, etype=-1): # Test # Create incoming packet streams for packet-generator interfaces pkts_cnt = 0 for i in self.pg_interfaces: if self.flows.__contains__(i): pkts = self.create_stream(i, self.pg_if_packet_sizes, traffic_type, ip_type, proto, ports, frags, pkt_raw, etype) if len(pkts) > 0: i.add_stream(pkts) pkts_cnt += len(pkts) # Enable packet capture and start packet sendingself.IPV self.pg_enable_capture(self.pg_interfaces) self.pg_start() # Verify # Verify outgoing packet streams per packet-generator interface for src_if in self.pg_interfaces: if self.flows.__contains__(src_if): for dst_if in self.flows[src_if]: capture = dst_if.get_capture(pkts_cnt) self.logger.info("Verifying capture on interface %s" % dst_if.name) self.verify_capture(dst_if, capture, traffic_type, ip_type, etype) def run_verify_negat_test(self, traffic_type=0, ip_type=0, proto=-1, ports=0, frags=False, etype=-1): # Test self.reset_packet_infos() for i in self.pg_interfaces: if self.flows.__contains__(i): pkts = self.create_stream(i, self.pg_if_packet_sizes, traffic_type, ip_type, proto, ports, frags, True, etype) if len(pkts) > 0: i.add_stream(pkts) # Enable packet capture and start packet sending self.pg_enable_capture(self.pg_interfaces) self.pg_start() # Verify # Verify outgoing packet streams per packet-generator interface for src_if in self.pg_interfaces: if self.flows.__contains__(src_if): for dst_if in self.flows[src_if]: self.logger.info("Verifying capture on interface %s" % dst_if.name) capture = dst_if.get_capture(0) self.assertEqual(len(capture), 0) def test_0000_warmup_test(self): """ ACL plugin version check; learn MACs """ self.create_hosts(16) self.run_traffic_no_check() reply = self.vapi.papi.acl_plugin_get_version() self.assertEqual(reply.major, 1) self.logger.info("Working with ACL plugin version: %d.%d" % ( reply.major, reply.minor)) # minor version changes are non breaking # self.assertEqual(reply.minor, 0) def test_0001_acl_create(self): """ ACL create/delete test """ self.logger.info("ACLP_TEST_START_0001") # Add an ACL r = [{'is_permit': 1, 'is_ipv6': 0, 'proto': 17, 'srcport_or_icmptype_first': 1234, 'srcport_or_icmptype_last': 1235, 'src_ip_prefix_len': 0, 'src_ip_addr': '\x00\x00\x00\x00', 'dstport_or_icmpcode_first': 1234, 'dstport_or_icmpcode_last': 1234, 'dst_ip_addr': '\x00\x00\x00\x00', 'dst_ip_prefix_len': 0}] # Test 1: add a new ACL reply = self.vapi.acl_add_replace(acl_index=4294967295, r=r, tag="permit 1234") self.assertEqual(reply.retval, 0) # The very first ACL gets #0 self.assertEqual(reply.acl_index, 0) first_acl = reply.acl_index rr = self.vapi.acl_dump(reply.acl_index) self.logger.info("Dumped ACL: " + str(rr)) self.assertEqual(len(rr), 1) # We should have the same number of ACL entries as we had asked self.assertEqual(len(rr[0].r), len(r)) # The rules should be the same. But because the submitted and returned # are different types, we need to iterate over rules and keys to get # to basic values. for i_rule in range(0, len(r) - 1): for rule_key in r[i_rule]: self.assertEqual(rr[0].r[i_rule][rule_key], r[i_rule][rule_key]) # Add a deny-1234 ACL r_deny = [{'is_permit': 0, 'is_ipv6': 0, 'proto': 17, 'srcport_or_icmptype_first': 1234, 'srcport_or_icmptype_last': 1235, 'src_ip_prefix_len': 0, 'src_ip_addr': '\x00\x00\x00\x00', 'dstport_or_icmpcode_first': 1234, 'dstport_or_icmpcode_last': 1234, 'dst_ip_addr': '\x00\x00\x00\x00', 'dst_ip_prefix_len': 0}, {'is_permit': 1, 'is_ipv6': 0, 'proto': 17, 'srcport_or_icmptype_first': 0, 'srcport_or_icmptype_last': 0, 'src_ip_prefix_len': 0, 'src_ip_addr': '\x00\x00\x00\x00', 'dstport_or_icmpcode_first': 0, 'dstport_or_icmpcode_last': 0, 'dst_ip_addr': '\x00\x00\x00\x00', 'dst_ip_prefix_len': 0}] reply = self.vapi.acl_add_replace(acl_index=4294967295, r=r_deny, tag="deny 1234;permit all") self.assertEqual(reply.retval, 0) # The second ACL gets #1 self.assertEqual(reply.acl_index, 1) second_acl = reply.acl_index # Test 2: try to modify a nonexistent ACL reply = self.vapi.acl_add_replace(acl_index=432, r=r, tag="FFFF:FFFF", expected_retval=-6) self.assertEqual(reply.retval, -6) # The ACL number should pass through self.assertEqual(reply.acl_index, 432) # apply an ACL on an interface inbound, try to delete ACL, must fail self.vapi.acl_interface_set_acl_list(sw_if_index=self.pg0.sw_if_index, n_input=1, acls=[first_acl]) reply = self.vapi.acl_del(acl_index=first_acl, expected_retval=-142) # Unapply an ACL and then try to delete it - must be ok self.vapi.acl_interface_set_acl_list(sw_if_index=self.pg0.sw_if_index, n_input=0, acls=[]) reply = self.vapi.acl_del(acl_index=first_acl, expected_retval=0) # apply an ACL on an interface outbound, try to delete ACL, must fail self.vapi.acl_interface_set_acl_list(sw_if_index=self.pg0.sw_if_index, n_input=0, acls=[second_acl]) reply = self.vapi.acl_del(acl_index=second_acl, expected_retval=-143) # Unapply the ACL and then try to delete it - must be ok self.vapi.acl_interface_set_acl_list(sw_if_index=self.pg0.sw_if_index, n_input=0, acls=[]) reply = self.vapi.acl_del(acl_index=second_acl, expected_retval=0) # try to apply a nonexistent ACL - must fail self.vapi.acl_interface_set_acl_list(sw_if_index=self.pg0.sw_if_index, n_input=1, acls=[first_acl], expected_retval=-6) self.logger.info("ACLP_TEST_FINISH_0001") def test_0002_acl_permit_apply(self): """ permit ACL apply test """ self.logger.info("ACLP_TEST_START_0002") rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, 0, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, 0, self.proto[self.IP][self.TCP])) # Apply rules self.apply_rules(rules, "permit per-flow") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, -1) self.logger.info("ACLP_TEST_FINISH_0002") def test_0003_acl_deny_apply(self): """ deny ACL apply test """ self.logger.info("ACLP_TEST_START_0003") # Add a deny-flows ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, self.proto[self.IP][self.UDP])) # Permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny per-flow;permit all") # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPV4, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0003") # self.assertEqual(1, 0) def test_0004_vpp624_permit_icmpv4(self): """ VPP_624 permit ICMPv4 """ self.logger.info("ACLP_TEST_START_0004") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.ICMP][self.ICMPv4])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit icmpv4") # Traffic should still pass self.run_verify_test(self.ICMP, self.IPV4, self.proto[self.ICMP][self.ICMPv4]) self.logger.info("ACLP_TEST_FINISH_0004") def test_0005_vpp624_permit_icmpv6(self): """ VPP_624 permit ICMPv6 """ self.logger.info("ACLP_TEST_START_0005") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE, self.proto[self.ICMP][self.ICMPv6])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit icmpv6") # Traffic should still pass self.run_verify_test(self.ICMP, self.IPV6, self.proto[self.ICMP][self.ICMPv6]) self.logger.info("ACLP_TEST_FINISH_0005") def test_0006_vpp624_deny_icmpv4(self): """ VPP_624 deny ICMPv4 """ self.logger.info("ACLP_TEST_START_0006") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE, self.proto[self.ICMP][self.ICMPv4])) # permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny icmpv4") # Traffic should not pass self.run_verify_negat_test(self.ICMP, self.IPV4, 0) self.logger.info("ACLP_TEST_FINISH_0006") def test_0007_vpp624_deny_icmpv6(self): """ VPP_624 deny ICMPv6 """ self.logger.info("ACLP_TEST_START_0007") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE, self.proto[self.ICMP][self.ICMPv6])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny icmpv6") # Traffic should not pass self.run_verify_negat_test(self.ICMP, self.IPV6, 0) self.logger.info("ACLP_TEST_FINISH_0007") def test_0008_tcp_permit_v4(self): """ permit TCPv4 """ self.logger.info("ACLP_TEST_START_0008") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv4 tcp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0008") def test_0009_tcp_permit_v6(self): """ permit TCPv6 """ self.logger.info("ACLP_TEST_START_0009") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip6 tcp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0008") def test_0010_udp_permit_v4(self): """ permit UDPv4 """ self.logger.info("ACLP_TEST_START_0010") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv udp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0010") def test_0011_udp_permit_v6(self): """ permit UDPv6 """ self.logger.info("ACLP_TEST_START_0011") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip6 udp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0011") def test_0012_tcp_deny(self): """ deny TCPv4/v6 """ self.logger.info("ACLP_TEST_START_0012") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 tcp") # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0012") def test_0013_udp_deny(self): """ deny UDPv4/v6 """ self.logger.info("ACLP_TEST_START_0013") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 udp") # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0013") def test_0014_acl_dump(self): """ verify add/dump acls """ self.logger.info("ACLP_TEST_START_0014") r = [[self.IPV4, self.PERMIT, 1234, self.proto[self.IP][self.TCP]], [self.IPV4, self.PERMIT, 2345, self.proto[self.IP][self.UDP]], [self.IPV4, self.PERMIT, 0, self.proto[self.IP][self.TCP]], [self.IPV4, self.PERMIT, 0, self.proto[self.IP][self.UDP]], [self.IPV4, self.PERMIT, 5, self.proto[self.ICMP][self.ICMPv4]], [self.IPV6, self.PERMIT, 4321, self.proto[self.IP][self.TCP]], [self.IPV6, self.PERMIT, 5432, self.proto[self.IP][self.UDP]], [self.IPV6, self.PERMIT, 0, self.proto[self.IP][self.TCP]], [self.IPV6, self.PERMIT, 0, self.proto[self.IP][self.UDP]], [self.IPV6, self.PERMIT, 6, self.proto[self.ICMP][self.ICMPv6]], [self.IPV4, self.DENY, self.PORTS_ALL, 0], [self.IPV4, self.DENY, 1234, self.proto[self.IP][self.TCP]], [self.IPV4, self.DENY, 2345, self.proto[self.IP][self.UDP]], [self.IPV4, self.DENY, 5, self.proto[self.ICMP][self.ICMPv4]], [self.IPV6, self.DENY, 4321, self.proto[self.IP][self.TCP]], [self.IPV6, self.DENY, 5432, self.proto[self.IP][self.UDP]], [self.IPV6, self.DENY, 6, self.proto[self.ICMP][self.ICMPv6]], [self.IPV6, self.DENY, self.PORTS_ALL, 0] ] # Add and verify new ACLs rules = [] for i in range(len(r)): rules.append(self.create_rule(r[i][0], r[i][1], r[i][2], r[i][3])) reply = self.vapi.acl_add_replace(acl_index=4294967295, r=rules) result = self.vapi.acl_dump(reply.acl_index) i = 0 for drules in result: for dr in drules.r: self.assertEqual(dr.is_ipv6, r[i][0]) self.assertEqual(dr.is_permit, r[i][1]) self.assertEqual(dr.proto, r[i][3]) if r[i][2] > 0: self.assertEqual(dr.srcport_or_icmptype_first, r[i][2]) else: if r[i][2] < 0: self.assertEqual(dr.srcport_or_icmptype_first, 0) self.assertEqual(dr.srcport_or_icmptype_last, 65535) else: if dr.proto == self.proto[self.IP][self.TCP]: self.assertGreater(dr.srcport_or_icmptype_first, self.tcp_sport_from-1) self.assertLess(dr.srcport_or_icmptype_first, self.tcp_sport_to+1) self.assertGreater(dr.dstport_or_icmpcode_last, self.tcp_dport_from-1) self.assertLess(dr.dstport_or_icmpcode_last, self.tcp_dport_to+1) elif dr.proto == self.proto[self.IP][self.UDP]: self.assertGreater(dr.srcport_or_icmptype_first, self.udp_sport_from-1) self.assertLess(dr.srcport_or_icmptype_first, self.udp_sport_to+1) self.assertGreater(dr.dstport_or_icmpcode_last, self.udp_dport_from-1) self.assertLess(dr.dstport_or_icmpcode_last, self.udp_dport_to+1) i += 1 self.logger.info("ACLP_TEST_FINISH_0014") def test_0015_tcp_permit_port_v4(self): """ permit single TCPv4 """ self.logger.info("ACLP_TEST_START_0015") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, port, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip4 tcp "+str(port)) # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP], port) self.logger.info("ACLP_TEST_FINISH_0015") def test_0016_udp_permit_port_v4(self): """ permit single UDPv4 """ self.logger.info("ACLP_TEST_START_0016") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, port, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip4 tcp "+str(port)) # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.UDP], port) self.logger.info("ACLP_TEST_FINISH_0016") def test_0017_tcp_permit_port_v6(self): """ permit single TCPv6 """ self.logger.info("ACLP_TEST_START_0017") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, port, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip4 tcp "+str(port)) # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.TCP], port) self.logger.info("ACLP_TEST_FINISH_0017") def test_0018_udp_permit_port_v6(self): """ permit single UPPv6 """ self.logger.info("ACLP_TEST_START_0018") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, port, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip4 tcp "+str(port)) # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.UDP], port) self.logger.info("ACLP_TEST_FINISH_0018") def test_0019_udp_deny_port(self): """ deny single TCPv4/v6 """ self.logger.info("ACLP_TEST_START_0019") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, port, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV6, self.DENY, port, self.proto[self.IP][self.TCP])) # Permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 udp "+str(port)) # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.TCP], port) self.logger.info("ACLP_TEST_FINISH_0019") def test_0020_udp_deny_port(self): """ deny single UDPv4/v6 """ self.logger.info("ACLP_TEST_START_0020") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, port, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.DENY, port, self.proto[self.IP][self.UDP])) # Permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 udp "+str(port)) # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.UDP], port) self.logger.info("ACLP_TEST_FINISH_0020") def test_0021_udp_deny_port_verify_fragment_deny(self): """ deny single UDPv4/v6, permit ip any, verify non-initial fragment blocked """ self.logger.info("ACLP_TEST_START_0021") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, port, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.DENY, port, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 udp "+str(port)) # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.UDP], port, True) self.logger.info("ACLP_TEST_FINISH_0021") def test_0022_zero_length_udp_ipv4(self): """ VPP-687 zero length udp ipv4 packet""" self.logger.info("ACLP_TEST_START_0022") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, port, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append( self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit empty udp ip4 " + str(port)) # Traffic should still pass # Create incoming packet streams for packet-generator interfaces pkts_cnt = 0 pkts = self.create_stream(self.pg0, self.pg_if_packet_sizes, self.IP, self.IPV4, self.proto[self.IP][self.UDP], port, False, False) if len(pkts) > 0: self.pg0.add_stream(pkts) pkts_cnt += len(pkts) # Enable packet capture and start packet sendingself.IPV self.pg_enable_capture(self.pg_interfaces) self.pg_start() self.pg1.get_capture(pkts_cnt) self.logger.info("ACLP_TEST_FINISH_0022") def test_0023_zero_length_udp_ipv6(self): """ VPP-687 zero length udp ipv6 packet""" self.logger.info("ACLP_TEST_START_0023") port = random.randint(0, 65535) # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.PERMIT, port, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit empty udp ip6 "+str(port)) # Traffic should still pass # Create incoming packet streams for packet-generator interfaces pkts_cnt = 0 pkts = self.create_stream(self.pg0, self.pg_if_packet_sizes, self.IP, self.IPV6, self.proto[self.IP][self.UDP], port, False, False) if len(pkts) > 0: self.pg0.add_stream(pkts) pkts_cnt += len(pkts) # Enable packet capture and start packet sendingself.IPV self.pg_enable_capture(self.pg_interfaces) self.pg_start() # Verify outgoing packet streams per packet-generator interface self.pg1.get_capture(pkts_cnt) self.logger.info("ACLP_TEST_FINISH_0023") def test_0108_tcp_permit_v4(self): """ permit TCPv4 + non-match range """ self.logger.info("ACLP_TEST_START_0108") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv4 tcp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0108") def test_0109_tcp_permit_v6(self): """ permit TCPv6 + non-match range """ self.logger.info("ACLP_TEST_START_0109") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip6 tcp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0109") def test_0110_udp_permit_v4(self): """ permit UDPv4 + non-match range """ self.logger.info("ACLP_TEST_START_0110") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv4 udp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0110") def test_0111_udp_permit_v6(self): """ permit UDPv6 + non-match range """ self.logger.info("ACLP_TEST_START_0111") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ip6 udp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV6, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0111") def test_0112_tcp_deny(self): """ deny TCPv4/v6 + non-match range """ self.logger.info("ACLP_TEST_START_0112") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 tcp") # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.TCP]) self.logger.info("ACLP_TEST_FINISH_0112") def test_0113_udp_deny(self): """ deny UDPv4/v6 + non-match range """ self.logger.info("ACLP_TEST_START_0113") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE_2, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_RANGE_2, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) rules.append(self.create_rule(self.IPV6, self.DENY, self.PORTS_RANGE, self.proto[self.IP][self.UDP])) # permit ip any any in the end rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_ALL, 0)) rules.append(self.create_rule(self.IPV6, self.PERMIT, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "deny ip4/ip6 udp") # Traffic should not pass self.run_verify_negat_test(self.IP, self.IPRANDOM, self.proto[self.IP][self.UDP]) self.logger.info("ACLP_TEST_FINISH_0113") def test_0300_tcp_permit_v4_etype_aaaa(self): """ permit TCPv4, send 0xAAAA etype """ self.logger.info("ACLP_TEST_START_0300") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv4 tcp") # Traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP]) # Traffic should still pass also for an odd ethertype self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP], 0, False, True, 0xaaaa) self.logger.info("ACLP_TEST_FINISH_0300") def test_0305_tcp_permit_v4_etype_blacklist_aaaa(self): """ permit TCPv4, whitelist 0x0BBB ethertype, send 0xAAAA, 0x0BBB """ self.logger.info("ACLP_TEST_START_0305") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # Apply rules self.apply_rules(rules, "permit ipv4 tcp") # whitelist the 0xbbbb etype - so the 0xaaaa should be blocked self.etype_whitelist([0xbbb], 1) # The IPv4 traffic should still pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP]) # The oddball ethertype should be blocked self.run_verify_negat_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP], 0, False, 0xaaaa) # The whitelisted traffic, on the other hand, should pass self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP], 0, False, True, 0x0bbb) # remove the whitelist, the previously blocked 0xAAAA should pass now self.etype_whitelist([], 0) self.run_verify_test(self.IP, self.IPV4, self.proto[self.IP][self.TCP], 0, False, True, 0xaaaa) self.logger.info("ACLP_TEST_FINISH_0305") def test_0315_del_intf(self): """ apply an acl and delete the interface """ self.logger.info("ACLP_TEST_START_0315") # Add an ACL rules = [] rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_RANGE_2, self.proto[self.IP][self.TCP])) rules.append(self.create_rule(self.IPV4, self.PERMIT, self.PORTS_RANGE, self.proto[self.IP][self.TCP])) # deny ip any any in the end rules.append(self.create_rule(self.IPV4, self.DENY, self.PORTS_ALL, 0)) # create an interface intf = [] intf.append(VppLoInterface(self)) # Apply rules self.apply_rules_to(rules, "permit ipv4 tcp", intf[0].sw_if_index) # Remove the interface intf[0].remove_vpp_config() self.logger.info("ACLP_TEST_FINISH_0315") if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)