Пример #1
0
 def delete_routes(self, routes):
     uniRoutes = []
     for route in routes:
         ip, prefix = route.split("/")
         addr = utils.ip_to_binary(ip)
         uniRoutes.append(IpPrefix(ip=addr, prefixLength=prefix))
     self.client.deleteUnicastRoutes(self.client_id, uniRoutes)
Пример #2
0
 def __init__(self, **kwargs):
     global args
     default_vals = {
         'host': None,
         'port': None,
         'entries': 32000,
         'percent': 10,
         'loops': 100,
         'minprefix': 16,
         'maxprefix': 64,
         'randseed': 0,  # we're going for pseudorandom, not real random
     }
     default_vals.update(kwargs)
     for kw, arg in default_vals.items():
         setattr(self, kw, arg)
     self.routes = {}
     self.generation = 1
     if (self.host is None) or (self.port is None):
         raise Exception("Test needs to specify 'host' and 'port' options")
     if (self.maxprefix > 120):
         raise Exception("Error: this tool is not yet smart" +
                         " enough to do maxprefix > 120")
     random.seed(self.randseed)
     self.client = FbossAgentClient(host=self.host, port=self.port)
     # a list of next hops; all routes point to same one: DROP
     self.nexthops = [utils.ip_to_binary(nh) for nh in []]
     self.client_id = 31336  # ID for our routes
Пример #3
0
 def delete_routes(self, routes):
     uniRoutes = []
     for route in routes:
         ip, prefix = route.split("/")
         addr = utils.ip_to_binary(ip)
         uniRoutes.append(IpPrefix(ip=addr, prefixLength=prefix))
     self.client.deleteUnicastRoutes(self.client_id, uniRoutes)
Пример #4
0
 def insert_routes(self, routes):
     uniRoutes = []
     for route in routes:
         ip, prefix = route.split("/")
         addr = utils.ip_to_binary(ip)
         ipRoute = IpPrefix(ip=addr, prefixLength=prefix)
         uniRoutes.append(UnicastRoute(dest=ipRoute, nextHopAddrs=self.nexthops))
     self.client.addUnicastRoutes(self.client_id, uniRoutes)
Пример #5
0
 def insert_routes(self, routes):
     uniRoutes = []
     for route in routes:
         ip, prefix = route.split("/")
         addr = utils.ip_to_binary(ip)
         ipRoute = IpPrefix(ip=addr, prefixLength=prefix)
         uniRoutes.append(UnicastRoute(dest=ipRoute, nextHopAddrs=self.nexthops))
     self.client.addUnicastRoutes(self.client_id, uniRoutes)
Пример #6
0
 def __init__(self, **kwargs):
     for kw, arg in StressRouteInsertion.defaults.items():
         setattr(self, kw, arg)
     for kw, arg in kwargs.items():
         setattr(self, kw, arg)
     self.routes = {}
     self.generation = 1
     if (self.host is None) or (self.port is None):
         raise Exception("Test needs to specify 'host' and 'port' options")
     if (self.maxprefix > 120):
         raise Exception("Error: this tool is not yet smart" +
                         " enough to do maxprefix > 120")
     random.seed(self.randseed)
     self.client = FbossAgentClient(host=self.host, port=self.port)
     # a list of next hops; all routes point to same one: DROP
     self.nexthops = [utils.ip_to_binary(nh) for nh in []]
     self.client_id = 31336      # ID for our routes
Пример #7
0
 def __init__(self, **kwargs):
     for kw, arg in StressRouteInsertion.defaults.items():
         setattr(self, kw, arg)
     for kw, arg in kwargs.items():
         setattr(self, kw, arg)
     self.routes = {}
     self.generation = 1
     if (self.host is None) or (self.port is None):
         raise Exception("Test needs to specify 'host' and 'port' options")
     if self.maxprefix > 120:
         raise Exception("Error: this tool is not yet smart" +
                         " enough to do maxprefix > 120")
     random.seed(self.randseed)
     self.client = PlainTextFbossAgentClient(host=self.host, port=self.port)
     # a list of next hops; all routes point to same one: DROP
     self.nexthops = [utils.ip_to_binary(nh) for nh in []]
     self.client_id = 31336  # ID for our routes
Пример #8
0
 def _flush_entry(self, ip, vlan):
     bin_ip = utils.ip_to_binary(ip)
     vlan_id = vlan
     with self._create_agent_client() as client:
         num_entries = client.flushNeighborEntry(bin_ip, vlan_id)
     print("Flushed {} entries".format(num_entries))
Пример #9
0
 def delete_route(self, route):
     ip, prefix = route.split("/")
     addr = utils.ip_to_binary(ip)
     ipRoute = IpPrefix(ip=addr, prefixLength=prefix)
     self.client.deleteUnicastRoute(self.client_id, ipRoute)
Пример #10
0
 def insert_route(self, route):
     ip, prefix = route.split("/")
     addr = utils.ip_to_binary(ip)
     ipRoute = IpPrefix(ip=addr, prefixLength=prefix)
     uniRoute = UnicastRoute(dest=ipRoute, nextHopAddrs=self.nexthops)
     self.client.addUnicastRoute(self.client_id, uniRoute)
Пример #11
0
 def run(self, ip, vlan):
     bin_ip = utils.ip_to_binary(ip)
     vlan_id = vlan
     client = self._create_ctrl_client()
     num_entries = client.flushNeighborEntry(bin_ip, vlan_id)
     print('Flushed {} entries'.format(num_entries))
Пример #12
0
 def run(self, ip, vlan):
     bin_ip = utils.ip_to_binary(ip)
     vlan_id = vlan
     client = self._create_ctrl_client()
     num_entries = client.flushNeighborEntry(bin_ip, vlan_id)
     print('Flushed {} entries'.format(num_entries))