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

Method create_stream

test/test_acl_plugin_macip.py:314–589  ·  view source on GitHub ↗
(
        self,
        mac_type,
        ip_type,
        packet_count,
        src_if,
        dst_if,
        traffic,
        is_ip6,
        tags=PERMIT_TAGS,
    )

Source from the content-addressed store, hash-verified

312 self.assertEqual(reply.count, expected_count)
313
314 def create_stream(
315 self,
316 mac_type,
317 ip_type,
318 packet_count,
319 src_if,
320 dst_if,
321 traffic,
322 is_ip6,
323 tags=PERMIT_TAGS,
324 ):
325 # exact MAC and exact IP
326 # exact MAC and subnet of IPs
327 # exact MAC and wildcard IP
328 # wildcard MAC and exact IP
329 # wildcard MAC and subnet of IPs
330 # wildcard MAC and wildcard IP
331 # OUI restricted MAC and exact IP
332 # OUI restricted MAC and subnet of IPs
333 # OUI restricted MAC and wildcard IP
334
335 packets = []
336 macip_rules = []
337 acl_rules = []
338 ip_permit = ""
339 mac_permit = ""
340 dst_mac = ""
341 mac_rule = "00:00:00:00:00:00"
342 mac_mask = "00:00:00:00:00:00"
343 for p in range(0, packet_count):
344 remote_dst_index = p % len(dst_if.remote_hosts)
345 remote_dst_host = dst_if.remote_hosts[remote_dst_index]
346
347 dst_port = 1234 + p
348 src_port = 4321 + p
349 is_permit = self.PERMIT if p % 3 == 0 else self.DENY
350 denyMAC = True if not is_permit and p % 3 == 1 else False
351 denyIP = True if not is_permit and p % 3 == 2 else False
352 if not is_permit and ip_type == self.WILD_IP:
353 denyMAC = True
354 if not is_permit and mac_type == self.WILD_MAC:
355 denyIP = True
356
357 if traffic == self.BRIDGED:
358 if is_permit:
359 src_mac = remote_dst_host._mac
360 dst_mac = "de:ad:00:00:00:00"
361 src_ip4 = remote_dst_host.ip4
362 dst_ip4 = src_if.remote_ip4
363 src_ip6 = remote_dst_host.ip6
364 dst_ip6 = src_if.remote_ip6
365 ip_permit = src_ip6 if is_ip6 else src_ip4
366 mac_permit = src_mac
367 if denyMAC:
368 mac = src_mac.split(":")
369 mac[0] = format(int(mac[0], 16) + 1, "02x")
370 src_mac = ":".join(mac)
371 if is_ip6:

Callers 1

run_trafficMethod · 0.95

Calls 12

AclRuleClass · 0.90
MacipRuleClass · 0.90
MACAddressClass · 0.90
formatFunction · 0.85
create_packet_infoMethod · 0.80
info_to_payloadMethod · 0.80
formatMethod · 0.80
add_dot1q_layerMethod · 0.80
add_dot1ad_layerMethod · 0.80
extend_packetMethod · 0.80
appendMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected