예제 #1
0
 def test_one_ip_nested(self):
     expected_results = sorted((('GOOGLE_DNS', ['8.8.8.8/32']),
                                ('GOOGLE_DNS -> GOOGLE_PUBLIC_DNS_ANYCAST',
                                 ['8.8.8.8/32']), ('ANY', ['0.0.0.0/0'])))
     ip = '8.8.8.8'
     results = sorted(get_ip_parents(ip, self.db))
     self.assertEquals(results, expected_results)
예제 #2
0
 def test_one_ipv6_nested(self):
   expected_results = sorted((('GOOGLE_DNS', ['2001:4860:4860::8844/128']),
                             ('GOOGLE_DNS -> GOOGLE_PUBLIC_DNS_ANYCAST',
                              ['2001:4860:4860::8844/128'])))
   ip = '2001:4860:4860::8844/128'
   results = sorted(get_ip_parents(ip, self.db))
   self.assertEquals(results, expected_results)
예제 #3
0
 def test_one_ip_nested(self):
   expected_results = sorted((('GOOGLE_DNS', ['8.8.8.8/32']),
                              ('GOOGLE_DNS -> GOOGLE_PUBLIC_DNS_ANYCAST',
                               ['8.8.8.8/32']),
                              ('ANY', ['0.0.0.0/0'])))
   ip = '8.8.8.8'
   results = sorted(get_ip_parents(ip, self.db))
   self.assertEquals(results, expected_results)
예제 #4
0
 def test_one_ipv6_nested(self):
     expected_results = sorted(
         (('GOOGLE_DNS', ['2001:4860:4860::8844/128']),
          ('GOOGLE_DNS -> GOOGLE_PUBLIC_DNS_ANYCAST',
           ['2001:4860:4860::8844/128'])))
     ip = '2001:4860:4860::8844/128'
     results = sorted(get_ip_parents(ip, self.db))
     self.assertEquals(results, expected_results)
예제 #5
0
 def test_one_ip_multi_nested(self):
     expected_results = sorted(
         (('INTERNAL_SERVERS -> INTERNAL_SERVER',
           ['1.0.0.1/32']), ('SERVERS -> INTERNAL_SERVER', ['1.0.0.1/32']),
          ('SERVERS -> INTERNAL_SERVERS', ['1.0.0.1/32']),
          ('SERVERS', ['1.0.0.1/32']), ('ANY', ['0.0.0.0/0'])))
     ip = '1.0.0.1'
     results = sorted(get_ip_parents(ip, self.db))
     self.assertEquals(results, expected_results)
예제 #6
0
 def test_one_ip_multi_nested(self):
   expected_results = sorted((('INTERNAL_SERVERS -> INTERNAL_SERVER',
                               ['1.0.0.1/32']),
                              ('SERVERS -> INTERNAL_SERVER', ['1.0.0.1/32']),
                              ('SERVERS -> INTERNAL_SERVERS', ['1.0.0.1/32']),
                              ('SERVERS', ['1.0.0.1/32']),
                              ('ANY', ['0.0.0.0/0'])))
   ip = '1.0.0.1'
   results = sorted(get_ip_parents(ip, self.db))
   self.assertEquals(results, expected_results)
예제 #7
0
 def test_one_ipv6_fail(self):
   expected_results = [('LINKLOCAL', ['FE80::/10'])]
   ip = '2001:db8::1'
   results = get_ip_parents(ip, self.db)
   self.assertNotEquals(results, expected_results)
예제 #8
0
 def test_one_ip_fail(self):
   expected_results = [('CLASS-E', ['240.0.0.0/4'])]
   ip = '1.1.1.1'
   results = get_ip_parents(ip, self.db)
   self.assertNotEquals(results, expected_results)
예제 #9
0
 def test_one_ipv6(self):
   expected_results = [('BOGON', ['2001:db8::/32'])]
   ip = '2001:db8::1'
   results = get_ip_parents(ip, self.db)
   self.assertEquals(results, expected_results)
예제 #10
0
 def test_one_ip(self):
   expected_results = [('ANY', ['0.0.0.0/0'])]
   ip = '1.1.1.1'
   results = get_ip_parents(ip, self.db)
   self.assertEquals(results, expected_results)
예제 #11
0
 def test_one_ipv6_fail(self):
     expected_results = [('LINKLOCAL', ['FE80::/10'])]
     ip = '2001:db8::1'
     results = get_ip_parents(ip, self.db)
     self.assertNotEquals(results, expected_results)
예제 #12
0
 def test_one_ip_fail(self):
     expected_results = [('CLASS-E', ['240.0.0.0/4'])]
     ip = '1.1.1.1'
     results = get_ip_parents(ip, self.db)
     self.assertNotEquals(results, expected_results)
예제 #13
0
 def test_one_ipv6(self):
     expected_results = [('BOGON', ['2001:db8::/32'])]
     ip = '2001:db8::1'
     results = get_ip_parents(ip, self.db)
     self.assertEquals(results, expected_results)
예제 #14
0
 def test_one_ip(self):
     expected_results = [('ANY', ['0.0.0.0/0'])]
     ip = '1.1.1.1'
     results = get_ip_parents(ip, self.db)
     self.assertEquals(results, expected_results)