コード例 #1
0
 def __init__(self):
     self.logger = logger
     self.faucet_event = []
     self.controller = Config().get_config()
     self.controller['max_concurrent_reinvestigations'] = 10
     self.s = SDNConnect()
     if 'POSEIDON_TRAVIS' in os.environ:
         self.s.r = redis.StrictRedis(host='localhost',
                                      port=6379,
                                      db=0,
                                      decode_responses=True)
     endpoint = Endpoint('foo')
     endpoint.endpoint_data = {
         'tenant': 'foo', 'mac': '00:00:00:00:00:00', 'segment': 'foo', 'port': '1'}
     endpoint.mirror()
     endpoint.known()
     self.s.endpoints.append(endpoint)
     endpoint = Endpoint('foo2')
     endpoint.endpoint_data = {
         'tenant': 'foo', 'mac': '00:00:00:00:00:00', 'segment': 'foo', 'port': '1'}
     endpoint.mirror()
     endpoint.known()
     self.s.endpoints.append(endpoint)
     self.s.store_endpoints()
     self.s.get_stored_endpoints()
コード例 #2
0
 def __init__(self):
     self.logger = logger
     self.fa_rabbit_routing_key = 'FAUCET.Event'
     self.faucet_event = None
     self.controller = Config().get_config()
     self.s = SDNConnect()
     self.s.controller['TYPE'] = 'None'
     self.s.get_sdn_context()
     self.s.controller['TYPE'] = 'bcf'
     self.s.get_sdn_context()
     self.s.controller['TYPE'] = 'faucet'
     self.s.get_sdn_context()
     if 'POSEIDON_TRAVIS' in os.environ:
         self.s.r = redis.StrictRedis(host='localhost',
                                      port=6379,
                                      db=0,
                                      decode_responses=True)
     endpoint = Endpoint('foo')
     endpoint.endpoint_data = {
         'tenant': 'foo',
         'mac': '00:00:00:00:00:00',
         'segment': 'foo',
         'port': '1'
     }
     endpoint.mirror()
     endpoint.p_prev_states.append((endpoint.state, int(time.time())))
     self.s.endpoints.append(endpoint)
     endpoint = Endpoint('foo2')
     endpoint.endpoint_data = {
         'tenant': 'foo',
         'mac': '00:00:00:00:00:00',
         'segment': 'foo',
         'port': '1'
     }
     endpoint.p_next_state = 'mirror'
     endpoint.queue()
     endpoint.p_prev_states.append((endpoint.state, int(time.time())))
     self.s.endpoints.append(endpoint)
     endpoint = Endpoint('foo3')
     endpoint.endpoint_data = {
         'tenant': 'foo',
         'mac': '00:00:00:00:00:00',
         'segment': 'foo',
         'port': '1'
     }
     self.s.endpoints.append(endpoint)
     self.s.store_endpoints()
     self.s.get_stored_endpoints()