1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# Copyright (c) 2018 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.
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(vpp C)
include(CheckCCompilerFlag)
include(cmake/misc.cmake)
include(cmake/cpu.cmake)
include(cmake/ccache.cmake)
##############################################################################
# VPP Version
##############################################################################
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND scripts/version
OUTPUT_VARIABLE VPP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "-" ";" VPP_LIB_VERSION ${VPP_VERSION})
list(GET VPP_LIB_VERSION 0 VPP_LIB_VERSION)
##############################################################################
# cross compiling
##############################################################################
if(CMAKE_CROSSCOMPILING)
set(CMAKE_IGNORE_PATH
/usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/
/usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/lib/
)
endif()
set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
##############################################################################
# build config
##############################################################################
check_c_compiler_flag("-Wno-address-of-packed-member"
compiler_flag_no_address_of_packed_member)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
if (CMAKE_BUILD_TYPE)
set(CMAKE_C_FLAGS "-g -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-fstack-protector-all ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Werror ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-DFORTIFY_SOURCE=2 ${CMAKE_C_FLAGS}")
endif()
if (compiler_flag_no_address_of_packed_member)
set(CMAKE_C_FLAGS "-Wno-address-of-packed-member ${CMAKE_C_FLAGS}")
endif()
set(CMAKE_C_FLAGS_RELEASE "-O2 ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_DEBUG "-O0 -DCLIB_DEBUG ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_LINKER_FLAGS_RELEASE "-pie -Wl,-z,now ${CMAKE_LINKER_FLAGS_RELEASE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UC)
##############################################################################
# install config
##############################################################################
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_MESSAGE NEVER)
include_directories (
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/include
)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "vpp")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include(cmake/syscall.cmake)
include(cmake/api.cmake)
include(cmake/library.cmake)
include(cmake/exec.cmake)
include(cmake/plugin.cmake)
##############################################################################
# subdirs - order matters
##########################
}
#!/usr/bin/env python
"""IP4 VRF Multi-instance Test Case HLD:
**NOTES:**
- higher number of pg-ip4 interfaces causes problems => only 15 pg-ip4 \
interfaces in 5 VRFs are tested
- jumbo packets in configuration with 15 pg-ip4 interfaces leads to \
problems too
- Reset of FIB table / VRF does not remove routes from IP FIB (see Jira \
ticket https://jira.fd.io/browse/VPP-560) so checks of reset VRF tables \
are skipped in tests 2, 3 and 4
**config 1**
- add 15 pg-ip4 interfaces
- configure 5 hosts per pg-ip4 interface
- configure 4 VRFs
- add 3 pg-ip4 interfaces per VRF
**test 1**
- send IP4 packets between all pg-ip4 interfaces in all VRF groups
**verify 1**
- check VRF data by parsing output of ip_fib_dump API command
- all packets received correctly in case of pg-ip4 interfaces in VRF
- no packet received in case of pg-ip4 interfaces not in VRF
**config 2**
- delete 2 VRFs
**test 2**
- send IP4 packets between all pg-ip4 interfaces in all VRF groups
**verify 2**
- check VRF data by parsing output of ip_fib_dump API command
- all packets received correctly in case of pg-ip4 interfaces in VRF
- no packet received in case of pg-ip4 interfaces not in VRF
**config 3**
- add 1 of deleted VRFs and 1 new VRF
**test 3**
- send IP4 packets between all pg-ip4 interfaces in all VRF groups
**verify 3**
- check VRF data by parsing output of ip_fib_dump API command
- all packets received correctly in case of pg-ip4 interfaces in VRF
- no packet received in case of pg-ip4 interfaces not in VRF
**config 4**
- delete all VRFs (i.e. no VRF except VRF=0 created)
**test 4**
- send IP4 packets between all pg-ip4 interfaces in all VRF groups
**verify 4**
- check VRF data by parsing output of ip_fib_dump API command
- all packets received correctly in case of pg-ip4 interfaces in VRF
- no packet received in case of pg-ip4 interfaces not in VRF
"""
import unittest
import random
from scapy.packet import Raw
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP, ARP
from framework import VppTestCase, VppTestRunner
from util import ppp
def is_ipv4_misc(p):
""" Is packet one of uninteresting IPv4 broadcasts? """
if p.haslayer(ARP):
return True
return False
class TestIp4VrfMultiInst(VppTestCase):
""" IP4 VRF Multi-instance Test Case """
@classmethod
def setUpClass(cls):
"""
Perform standard class setup (defined by class method setUpClass in
class VppTestCase) before running the test case, set test case related
variables and configure VPP.
"""
super(TestIp4VrfMultiInst, cls).setUpClass()
# Test variables
cls.hosts_p
|