示例#1
0
 def test_router_lsa(self):
     link1 = ospf.RouterLSA.Link(id_='10.0.0.1', data='255.255.255.0',
                                 type_=ospf.LSA_LINK_TYPE_STUB, metric=10)
     msg = ospf.RouterLSA(id_='192.168.0.1', adv_router='192.168.0.2',
                          links=[link1])
     binmsg = msg.serialize()
     msg2, cls, rest = ospf.LSA.parser(binmsg)
     eq_(msg.header.checksum, msg2.header.checksum)
     eq_(str(msg), str(msg2))
     eq_(rest, b'')
示例#2
0
 def test_lsupd(self):
     link1 = ospf.RouterLSA.Link(id_='10.0.0.1', data='255.255.255.0',
                                 type_=ospf.LSA_LINK_TYPE_STUB, metric=10)
     lsa1 = ospf.RouterLSA(id_='192.168.0.1', adv_router='192.168.0.2',
                           links=[link1])
     msg = ospf.OSPFLSUpd(router_id='192.168.0.1', lsas=[lsa1])
     binmsg = msg.serialize()
     msg2, cls, rest = ospf.OSPFMessage.parser(binmsg)
     eq_(msg.checksum, msg2.checksum)
     eq_(str(msg), str(msg2))
     eq_(rest, b'')