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
|
# Copyright (c) 2019 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.
"""DUT PAPI command history setup library."""
from robot.api import logger
from resources.libraries.python.topology import NodeType, DICT__nodes
__all__ = ["DICT__DUTS_PAPI_HISTORY", "PapiHistory"]
DICT__DUTS_PAPI_HISTORY = dict()
class PapiHistory(object):
"""Contains methods to set up DUT PAPI command history.
"""
@staticmethod
def reset_papi_history(node):
"""Reset PAPI command history for DUT node.
:param node: DUT node to reset PAPI command history for.
:type node: dict
"""
DICT__DUTS_PAPI_HISTORY[node['host']] = list()
@staticmethod
def reset_papi_history_on_all_duts(nodes):
"""Reset PAPI command history for all DUT nodes.
:param nodes: Nodes to reset PAPI command history for.
:type nodes: dict
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
PapiHistory.reset_papi_history(node)
@staticmethod
def add_to_papi_history(node, csit_papi_command, papi=True, **kwargs):
"""Add command to PAPI command history on DUT node.
The argument name 'csit_papi_command' must be unique enough as it cannot
be repeated in kwargs.
Examples of PAPI history items:
Request without parameters:
show_threads()
Request with parameters:
ipsec_select_backend(index=1,protocol=1)
Dump:
sw_interface_rx_placement_dump(sw_if_index=4)
VPP Stats:
vpp-stats(path=['^/if', '/err/ip4-input', '/sys/node/ip4-input'])
VAT:
sw_interface_set_flags sw_if_index 3 admin-up link-up
:param node: DUT node to add command to PAPI command history for.
:param csit_papi_command: Command to be added to PAPI command history.
:param papi: Says if the command to store is PAPi or VAT. Remove when
VAT executor is completely removed.
:param kwargs: Optional key-value arguments.
:type node: dict
:type csit_papi_command: str
/*
* Copyright (c) 2017 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.
*/
/**
* @file
* @brief NAT64 IPv4 to IPv6 translation (otside to inside network)
*/
#include <snat/nat64.h>
#include <vnet/ip/ip4_to_ip6.h>
#include <vnet/fib/ip4_fib.h>
typedef struct
{
u32 sw_if_index;
u32 next_index;
} nat64_out2in_trace_t;
static u8 *
format_nat64_out2in_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
nat64_out2in_trace_t *t = va_arg (*args, nat64_out2in_trace_t *);
s =
format (s, "NAT64-out2in: sw_if_index %d, next index %d", t->sw_if_index,
t->next_index);
return s;
}
vlib_node_registration_t nat64_out2in_node;
#define foreach_nat64_out2in_error \
_(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
_(OUT2IN_PACKETS, "Good out2in packets processed") \
_(NO_TRANSLATION, "No translation") \
_(UNKNOWN, "unknown")
typedef enum
{
#define _(sym,str) NAT64_OUT2IN_ERROR_##sym,
foreach_nat64_out2in_error
#undef _
NAT64_OUT2IN_N_ERROR,
} nat64_out2in_error_t;
static char *nat64_out2in_error_strings[] = {
#define _(sym,string) string,
foreach_nat64_out2in_error
#undef _
};
typedef enum
{
NAT64_OUT2IN_NEXT_LOOKUP,
NAT64_OUT2IN_NEXT_DROP,
NAT64_OUT2IN_N_NEXT,
} nat64_out2in_next
|