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

Method create_hosts

test/test_l2bd_multi_instance.py:155–174  ·  view source on GitHub ↗

Create required number of host MAC addresses and distribute them among interfaces. Create host IPv4 address for every host MAC address. :param int hosts_per_if: Number of hosts per if to create MAC/IPv4 addresses for.

(cls, hosts_per_if)

Source from the content-addressed store, hash-verified

153
154 @classmethod
155 def create_hosts(cls, hosts_per_if):
156 """
157 Create required number of host MAC addresses and distribute them
158 among interfaces. Create host IPv4 address for every host MAC
159 address.
160
161 :param int hosts_per_if: Number of hosts per if to create MAC/IPv4
162 addresses for.
163 """
164 c = hosts_per_if
165 assert not cls.hosts_by_pg_idx
166 for i in range(len(cls.pg_interfaces)):
167 pg_idx = cls.pg_interfaces[i].sw_if_index
168 cls.hosts_by_pg_idx[pg_idx] = [
169 Host(
170 "00:00:00:ff:%02x:%02x" % (pg_idx, j + 1),
171 "172.17.1%02u.%u" % (pg_idx, j + 1),
172 )
173 for j in range(c)
174 ]
175
176 @classmethod
177 def bd_if_range(cls, b):

Callers 1

setUpClassMethod · 0.45

Calls 1

HostClass · 0.90

Tested by

no test coverage detected