コード例 #1
0
ファイル: __init__.py プロジェクト: periscope-ps/periscope
 def test_register_metadata(self):
     # TODO more testing is needed
     results = open(self.PATH + 'hls_snmp.xml').read()
     results_set = ResultSet.parse_result(results)
     services = parse_lookup_service_result(results_set)
     
     self.assertEqual(len(services), 2)
     self.assertEqual(len(services[0]['data']), 8)
     self.assertEqual(len(services[1]['data']), 5)
     
     for psservice in services:
         serviceType = psservice['service'].serviceType
         serviceName = psservice['service'].serviceName
         accessPoint = psservice['service'].accessPoint
         serviceDescription = psservice['service'].serviceDescription
         
         service = create_psservice(serviceName,
                 accessPoint,
                 serviceType,
                 serviceDescription,
                 psservice['event_types'])
         
         for data in psservice['data']:
             obj = register_metadata(service, data.data)
             # check if all data elements were registered
             watch = psServiceWatchList.objects.filter(service=service, network_object=obj)
             self.assertTrue(watch.count() > 0)
コード例 #2
0
ファイル: __init__.py プロジェクト: periscope-ps/periscope
 def test_interface_to_port(self):
     # TODO test with create port is False
     results = open(self.PATH + 'hls_snmp.xml').read()
     results_set = ResultSet.parse_result(results)
     services = parse_lookup_service_result(results_set)
     
     for psservice in services:
         for data in psservice['data']:
             port = interface_to_port(data.subject.contents)
             self.assertIsInstance(port, Port)
コード例 #3
0
ファイル: __init__.py プロジェクト: periscope-ps/periscope
 def test_parse_lookup_service_result(self):
     results = open(self.PATH + 'hls_snmp.xml').read()
     results_set = ResultSet.parse_result(results)
     services = parse_lookup_service_result(results_set)
     
     self.assertEqual(len(services), 2)
     self.assertEqual(len(services[0]['data']), 8)
     self.assertEqual(len(services[1]['data']), 5)
     
     event_types = [ events.NET_ERROR,
         events.NET_DISCARD,
         events.NET_UTILIZATION
     ]
     
     for service in services:
         for data in service['data']:
             self.assertIsNotNone(data)
         for event in event_types:
             self.assertTrue(event in service['event_types'])