MCPcopy Create free account
hub / github.com/FDio/vpp / setUpClass

Method setUpClass

test/test_acl_plugin.py:88–155  ·  view source on GitHub ↗

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.

(cls)

Source from the content-addressed store, hash-verified

86
87 @classmethod
88 def setUpClass(cls):
89 """
90 Perform standard class setup (defined by class method setUpClass in
91 class VppTestCase) before running the test case, set test case related
92 variables and configure VPP.
93 """
94 super(TestACLplugin, cls).setUpClass()
95
96 try:
97 # Create 2 pg interfaces
98 cls.create_pg_interfaces(range(2))
99
100 # Packet flows mapping pg0 -> pg1, pg2 etc.
101 cls.flows = dict()
102 cls.flows[cls.pg0] = [cls.pg1]
103
104 # Packet sizes
105 cls.pg_if_packet_sizes = [64, 512, 1518, 9018]
106
107 # Create BD with MAC learning and unknown unicast flooding disabled
108 # and put interfaces to this BD
109 cls.vapi.bridge_domain_add_del_v2(
110 bd_id=cls.bd_id, uu_flood=1, learn=1, flood=1, forward=1, is_add=1
111 )
112 for pg_if in cls.pg_interfaces:
113 cls.vapi.sw_interface_set_l2_bridge(
114 rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id
115 )
116
117 # Set up all interfaces
118 for i in cls.pg_interfaces:
119 i.admin_up()
120
121 # Mapping between packet-generator index and lists of test hosts
122 cls.hosts_by_pg_idx = dict()
123 for pg_if in cls.pg_interfaces:
124 cls.hosts_by_pg_idx[pg_if.sw_if_index] = []
125
126 # Create list of deleted hosts
127 cls.deleted_hosts_by_pg_idx = dict()
128 for pg_if in cls.pg_interfaces:
129 cls.deleted_hosts_by_pg_idx[pg_if.sw_if_index] = []
130
131 # warm-up the mac address tables
132 # self.warmup_test()
133 count = 16
134 start = 0
135 n_int = len(cls.pg_interfaces)
136 macs_per_if = count // n_int
137 i = -1
138 for pg_if in cls.pg_interfaces:
139 i += 1
140 start_nr = macs_per_if * i + start
141 end_nr = (
142 count + start if i == (n_int - 1) else macs_per_if * (i + 1) + start
143 )
144 hosts = cls.hosts_by_pg_idx[pg_if.sw_if_index]
145 for j in range(int(start_nr), int(end_nr)):

Callers

nothing calls this directly

Calls 5

HostClass · 0.90
create_pg_interfacesMethod · 0.80
appendMethod · 0.80
admin_upMethod · 0.45
tearDownClassMethod · 0.45

Tested by

no test coverage detected