Ejemplo n.º 1
0
 def test_elink(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'elink,trd-gw,uninett')
     self.assertNotEquals(d, None)
     self.assertEqual(d['to_router'], 'trd-gw')
     self.assertEqual(d['to_org'], 'uninett')
     self.assertEqual(d['netident'], '%s,%s' % (self.sysname, 'trd-gw'))
Ejemplo n.º 2
0
 def test_lan(self):
     d = descrparsers.parse_ntnu_convention(
         self.sysname, 'lan,math,staff')
     self.assertNotEquals(d, None)
     self.assertEqual(d['org'], 'math')
     self.assertEqual(d['usage'], 'staff')
     self.assertEqual(d['netident'], 'math,staff')
Ejemplo n.º 3
0
 def test_link_with_comment_and_vlan(self):
     d = descrparsers.parse_ntnu_convention(
         self.sysname, 'link,moholt-gw,Tn_20022350,923')
     self.assertEqual(d['to_router'], 'moholt-gw')
     self.assertEqual(d['comment'], 'Tn_20022350')
     self.assertEqual(d['netident'], '%s,%s' % (self.sysname, 'moholt-gw'))
     self.assertEqual(d['vlan'], 923)
Ejemplo n.º 4
0
 def test_elink(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'elink,trd-gw,uninett')
     d is not None
     assert d['to_router'] == 'trd-gw'
     assert d['to_org'] == 'uninett'
     assert d['netident'] == '%s,%s' % (self.sysname, 'trd-gw')
Ejemplo n.º 5
0
 def test_core_with_comment_and_vlan(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'core,it,fddi,manring,180')
     d is not None
     assert d['org'] == 'it'
     assert d['usage'] == 'fddi'
     assert d['comment'] == 'manring'
     assert d['netident'] == 'it,fddi,manring'
     assert d['vlan'] == 180
Ejemplo n.º 6
0
 def test_elink_with_empty_comment(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'elink,sintef-gw,sintef,,902')
     d is not None
     assert d['to_router'] == 'sintef-gw'
     assert d['to_org'] == 'sintef'
     assert not d['comment']
     assert d['netident'] == '%s,%s' % (self.sysname, 'sintef-gw')
     assert d['vlan'] == 902
Ejemplo n.º 7
0
 def test_core_with_comment_and_vlan(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'core,it,fddi,manring,180')
     self.assertNotEquals(d, None)
     self.assertEqual(d['org'], 'it')
     self.assertEqual(d['usage'], 'fddi')
     self.assertEqual(d['comment'], 'manring')
     self.assertEqual(d['netident'], 'it,fddi,manring')
     self.assertEqual(d['vlan'], 180)
Ejemplo n.º 8
0
 def test_lan_with_numbered_usage_and_comment(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'lan,math,staff12,campus_lade')
     d is not None
     assert d['org'] == 'math'
     assert d['usage'] == 'staff'
     assert d['n'] == 12
     assert d['netident'] == 'math,staff12,campus_lade'
     assert d['comment'] == 'campus_lade'
Ejemplo n.º 9
0
 def test_lan_with_spaces(self):
     d = descrparsers.parse_ntnu_convention(
         self.sysname, 'lan ,physics,students,  campus_dragv, 340')
     self.assertNotEquals(d, None)
     self.assertEqual(d['org'], 'physics')
     self.assertEqual(d['usage'], 'students')
     self.assertEqual(d['comment'], 'campus_dragv')
     self.assertEqual(d['netident'], 'physics,students,campus_dragv')
     self.assertEqual(d['vlan'], 340)
Ejemplo n.º 10
0
 def test_lan_with_numbered_usage_and_comment(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'lan,math,staff12,campus_lade')
     self.assertNotEquals(d, None)
     self.assertEqual(d['org'], 'math')
     self.assertEqual(d['usage'], 'staff')
     self.assertEqual(d['n'], 12)
     self.assertEqual(d['netident'], 'math,staff12,campus_lade')
     self.assertEqual(d['comment'], 'campus_lade')
Ejemplo n.º 11
0
 def test_elink_with_empty_comment(self):
     d = descrparsers.parse_ntnu_convention(self.sysname,
                                            'elink,sintef-gw,sintef,,902')
     self.assertNotEquals(d, None)
     self.assertEqual(d['to_router'], 'sintef-gw')
     self.assertEqual(d['to_org'], 'sintef')
     self.assertFalse(d['comment'])
     self.assertEqual(d['netident'], '%s,%s' % (self.sysname, 'sintef-gw'))
     self.assertEqual(d['vlan'], 902)
Ejemplo n.º 12
0
 def test_lan_with_spaces(self):
     d = descrparsers.parse_ntnu_convention(
         self.sysname, 'lan ,physics,students,  campus_dragv, 340')
     d is not None
     assert d['org'] == 'physics'
     assert d['usage'] == 'students'
     assert d['comment'] == 'campus_dragv'
     assert d['netident'] == 'physics,students,campus_dragv'
     assert d['vlan'] == 340
Ejemplo n.º 13
0
 def test_link(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'link,mts-gw')
     self.assertNotEquals(d, None)
     self.assertEqual(d['to_router'], 'mts-gw')
Ejemplo n.º 14
0
 def test_core(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'core,it,wlan')
     d is not None
     assert d['org'] == 'it'
     assert d['usage'] == 'wlan'
     assert d['netident'] == 'it,wlan'
Ejemplo n.º 15
0
 def test_link(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'link,mts-gw')
     d is not None
     assert d['to_router'] == 'mts-gw'
Ejemplo n.º 16
0
 def test_lan_invalid(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'lan,foo')
     assert d is None
Ejemplo n.º 17
0
 def test_lan(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'lan,math,staff')
     assert d is not None
     assert d['org'] == 'math'
     assert d['usage'] == 'staff'
     assert d['netident'] == 'math,staff'
Ejemplo n.º 18
0
 def test_invalid(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'foobar,bar,baz')
     assert d is None
Ejemplo n.º 19
0
 def test_core_invalid(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'core,foo')
     self.assertEquals(d, None)
Ejemplo n.º 20
0
 def test_core(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'core,it,wlan')
     self.assertNotEquals(d, None)
     self.assertEqual(d['org'], 'it')
     self.assertEqual(d['usage'], 'wlan')
     self.assertEqual(d['netident'], 'it,wlan')
Ejemplo n.º 21
0
 def test_invalid(self):
     d = descrparsers.parse_ntnu_convention(self.sysname, 'foobar,bar,baz')
     self.assertEquals(d, None)