• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.pad函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中veripy.util.pad函数的典型用法代码示例。如果您正苦于以下问题:Python pad函数的具体用法?Python pad怎么用?Python pad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pad函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: run

    def run(self):
        self.logger.info("Forwarding ICMPv6 echo request from TN2 to NUT...")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1280, True))

        self.logger.info("Checking for a reply...")
        r1 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r1), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertNotFragmented(r1[0])

        self.logger.info("Sending Packet Too Big message to NUT for Echo Reply with MTU set to %d" % (self.mtu))
        self.router(1).send(
            IPv6(src=str(self.router(1).global_ip(iface=1)), dst=str(self.target(1).global_ip()))/
                ICMPv6PacketTooBig(mtu=56)/
                    Raw(load=r1[0].build()[:(56-48)]), iface=1)

        self.node(2).clear_received()
        self.logger.info("Forwarding another ICMPv6 echo request from TN2 to NUT...")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1280, True))

        self.ui.wait(5)
        self.logger.info("Checking for replies...")
        r2 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r2), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertHasLayer(IPv6ExtHdrFragment, r2[0], "expected the Echo Reply to contain a fragment header")
开发者ID:mwrlabs,项目名称:veripy,代码行数:30,代码来源:receiving_mtu_below_ipv6_minimum.py


示例2: run

    def run(self):
        self.logger.info("Forwarding ICMPv6 echo request from TN2 to NUT")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))

        self.logger.info("Checking for a reply...")
        r1 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r1), "expected to receive a ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertNotFragmented(r1[0])

        self.logger.info("Sending Packet Too Big message to NUT for Echo Reply for TN2")
        self.node(2).send( \
            IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                ICMPv6PacketTooBig(mtu=1280, code=0xFF)/
                    Raw(load=r1[0].build()[:(1280-48)]))

        self.node(2).clear_received()
         
        self.logger.info("Forwarding ICMPv6 echo request from TN2 to NUT")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))
        
        self.logger.info("Checking for fragmented replies...")
        r2 = self.node(2).received(src=self.target(1).global_ip())

        self.ui.wait(5)
        self.logger.info("Checking for replies...")
        r2 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r2), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertFragmented(r2[0], self.node(2).received(), count=2, size=1280, reassemble_to=1500)
        
开发者ID:bobdoah,项目名称:veripy,代码行数:34,代码来源:non_zero_icmpv6_code.py


示例3: run

    def run(self):
        self.logger.info("Forwarding ICMPv6 echo request from TN2 to NUT...")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))

        self.logger.info("Checking for a reply...")
        r1 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r1), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertNotFragmented(r1[0])
        
        self.logger.info("Sending Router Advertisement from TR1, with the MTU option set to 1280")
        self.router(1).send(
            IPv6(src=str(self.router(1).link_local_ip(iface=1)), dst="ff01::2")/
                ICMPv6ND_RA()/
                    ICMPv6NDOptMTU(mtu=1280), iface=1)

        self.logger.info("Forwarding another ICMPv6 echo request from TN2 to NUT...")
        for f in fragment6(util.pad(IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/ICMPv6EchoRequest(seq=self.next_seq()), 1500, True), 1280):
            self.node(2).send(f)

        self.ui.wait(5)
        self.logger.info("Checking for replies...")
        r2 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r2), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertFragmented(r2[0], self.node(1).received(), count=2, size=1280, reassemble_to=1500)
        
开发者ID:mwrlabs,项目名称:veripy,代码行数:27,代码来源:router_advertisement_with_mtu_option.py


示例4: test_all_replies_with_fragmentation

    def test_all_replies_with_fragmentation(self):
        self.ifx.replies_with(
            util.pad(
                IPv6(
                    src=str(self.ifx.global_ip()),
                    dst=str(self.tn2.global_ip())) / IPv6ExtHdrFragment() /
                ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(
            fragment6(
                util.pad(
                    IPv6(
                        src=str(self.ifx.global_ip()),
                        dst=str(self.tn2.global_ip())) / IPv6ExtHdrFragment() /
                    ICMPv6EchoReply(), 1500, True), 1400))
        self.ifx.replies_with(None)
        self.ifx.replies_with(
            fragment6(
                util.pad(
                    IPv6(
                        src=str(self.ifx.global_ip()),
                        dst=str(self.tn2.global_ip())) / IPv6ExtHdrFragment() /
                    ICMPv6EchoReply(), 1500, True), 1280))

        o = self.get_outcome(suite.ReducePMTUOffLinkTestCase)

        self.assertCheckPasses(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:27,代码来源:reduce_pmtu_off_link_test_case.py


示例5: test_second_reply_is_not_fragmented

    def test_second_reply_is_not_fragmented(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True))

        o = self.get_outcome(suite.MTUEqualTo0x1ffffffTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:increase_estimate_test_case.py


示例6: test_valid_fragmentation

    def test_valid_fragmentation(self): # or lack thereof
	self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1280, True))
	self.ifx.replies_with(None)
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1280, True))

        o = self.get_outcome(suite.MTUEqualTo56TestCase)
        
        self.assertCheckPasses(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:receiving_mtu_below_ipv6_minimum_test_case.py


示例7: test_second_reply_not_fragmented

    def test_second_reply_not_fragmented(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))

        o = self.get_outcome(suite.CheckingForIncreaseInPMTUTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:checking_for_increase_in_pmtu_test_case.py


示例8: test_fragmented_below_minimum_mtu

    def test_fragmented_below_minimum_mtu(self):
	self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1280, True))
	self.ifx.replies_with(None)
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1280, True), 1279))

        o = self.get_outcome(suite.MTUEqualTo1279TestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:receiving_mtu_below_ipv6_minimum_test_case.py


示例9: test_no_reply_to_third_echo_request

 def test_no_reply_to_third_echo_request(self):
     self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
     self.ifx.replies_with(None)
     self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1304))
     
     o = self.get_outcome(suite.MTUIncreaseTestCase)
     
     self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:increase_estimate_test_case.py


示例10: test_unfragmented_reply_without_fragmentation_header

    def test_unfragmented_reply_without_fragmentation_header(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1280, True))
	self.ifx.replies_with(None)
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1280, True))

        o = self.get_outcome(suite.MTUEqualTo56TestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:receiving_mtu_below_ipv6_minimum_test_case.py


示例11: test_no_subsequent_replies

    def test_no_subsequent_replies(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1304))

        o = self.get_outcome(suite.CheckingForIncreaseInPMTUTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:checking_for_increase_in_pmtu_test_case.py


示例12: test_first_and_second_no_fragmentation

    def test_first_and_second_no_fragmentation(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True))

        o = self.get_outcome(suite.ReducePMTUOffLinkTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:8,代码来源:reduce_pmtu_off_link_test_case.py


示例13: test_valid

    def test_valid(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1304))
        self.ifx.replies_with(None)
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1304))

        o = self.get_outcome(suite.MTUEqualTo0x1ffffffTestCase)

        self.assertCheckPasses(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:10,代码来源:increase_estimate_test_case.py


示例14: test_all_replies

    def test_all_replies(self):
        # Step 14: We expect the NUT to respond to echo requests from TN1, TN2
        #          and TN3 with fragmented packets, because we have changed the
        #          MTU on the links.
        
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/ICMPv6EchoReply(), 1500, True))

        # Step 5: we have sent a Packet Too Big message from TN2, it gets no
        #         reply
        self.ifx.replies_with(None)
        
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1400))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/ICMPv6EchoReply(), 1500, True))

        # Step 10: we have sent a Packet Too Big message from TN3, it gets no
        #          reply
        self.ifx.replies_with(None)
        
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1400))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1280))

        o = self.get_outcome(suite.StoredPMTUTestCase)

        self.assertCheckPasses(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:28,代码来源:stored_pmtu_test_case.py


示例15: test_all_replies_fragmented_to_maximum_mtu

    def test_all_replies_fragmented_to_maximum_mtu(self):
        # Step 14: We expect the NUT to respond to echo requests from TN1, TN2
        #          and TN3 a second time, with packets from TN2 fragmented
        #          because we have changed the MTU on the links.
        #          We actually, deliver fragments that are too large.

        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/ICMPv6EchoReply(), 1500, True))

        # Step 5: we have sent a Packet Too Big message from TN2, it gets no
        #         reply
        self.ifx.replies_with(None)

        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1400))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/ICMPv6EchoReply(), 1500, True))

        # Step 10: we have sent a Packet Too Big message from TN3, it gets no
        #          reply
        self.ifx.replies_with(None)

        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1400))
        self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn3.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1400))

        o = self.get_outcome(suite.StoredPMTUTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:29,代码来源:stored_pmtu_test_case.py


示例16: test_pmtu_increase_too_early

    def test_pmtu_increase_too_early(self):
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(None)
        for i in range(0, 5):
            self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1304))
        for i in range(5, 6):
            self.ifx.replies_with(fragment6(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/IPv6ExtHdrFragment()/ICMPv6EchoReply(), 1500, True), 1500))

        o = self.get_outcome(suite.CheckingForIncreaseInPMTUTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:11,代码来源:checking_for_increase_in_pmtu_test_case.py


示例17: test_second_reply_not_fragmented

    def test_second_reply_not_fragmented(self):
        self.ifx.replies_with(
            util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip())) / ICMPv6EchoReply(), 1500, True)
        )
        self.ifx.replies_with(
            util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip())) / ICMPv6EchoReply(), 1500, True)
        )

        o = self.get_outcome(suite.RouterAdvertisementWithMTUOptionTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:11,代码来源:router_advertisement_with_mtu_option_test_case.py


示例18: test_first_reply_from_tn3_missing

    def test_first_reply_from_tn3_missing(self):
        # Step  4: We expect the NUT to respond to echo requests from TN1, TN2
        #       and TN3.
        #       We actually, only deliver the replies from TN1 and TN2.

        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip()))/ICMPv6EchoReply(), 1500, True))
        self.ifx.replies_with(util.pad(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn2.global_ip()))/ICMPv6EchoReply(), 1500, True))

        o = self.get_outcome(suite.StoredPMTUTestCase)

        self.assertCheckFails(o)
开发者ID:bobdoah,项目名称:veripy,代码行数:11,代码来源:stored_pmtu_test_case.py


示例19: run

    def run(self):
        self.logger.info("Forwarding ICMPv6 echo request from TN2 to NUT...")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))

        self.logger.info("Checking for a reply...")
        r1 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r1), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertNotFragmented(r1[0])
        
        self.logger.info("Sending a Packet Too Big message to NUT with MTU set to 1304...")
        self.router(1).send( \
            IPv6(src=str(self.router(1).global_ip(iface=1)), dst=str(self.target(1).global_ip()))/
                ICMPv6PacketTooBig(mtu=1304)/
                    Raw(load=r1[0].build()[:(1304-48)]), iface=1)

        self.node(2).clear_received()

        self.logger.info("Forwarding another ICMPv6 echo request from TN2 to NUT...")
        self.node(2).send( \
            util.pad( \
                IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                    ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))

        self.ui.wait(5)
        self.logger.info("Checking for replies...")
        r2 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
        assertEqual(1, len(r2), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
        assertFragmented(r2[0], self.node(2).received(), count=2, size=1304, reassemble_to=1500)

        for i in range(0,5):
            self.ui.wait(30)
            
            self.node(2).clear_received()

            self.logger.info("Forwarding another ICMPv6 echo request from TN2 to NUT (%d)..." % (i))
            self.node(2).send( \
                util.pad( \
                    IPv6(src=str(self.node(2).global_ip()), dst=str(self.target(1).global_ip()))/
                        ICMPv6EchoRequest(seq=self.next_seq()), 1500, True))

            self.ui.wait(5)
            self.logger.info("Checking for replies...")
            r2 = self.node(2).received(src=self.target(1).global_ip(), seq=self.seq(), type=ICMPv6EchoReply)
            assertEqual(1, len(r2), "expected to receive an ICMPv6 Echo Reply (seq: %d)" % (self.seq()))
            assertFragmented(r2[0], self.node(2).received(), count=2, size=1304, reassemble_to=1500)
            
开发者ID:bobdoah,项目名称:veripy,代码行数:48,代码来源:checking_for_increase_in_pmtu.py


示例20: run

    def run(self):
        self.logger.info("Sending ICMPv6 echo request from TN4 to TN2, via 6in6 tunnel.")
        self.node(4).send(
            util.pad(IPv6(src=str(self.node(4).global_ip()), dst=str(self.node(2).global_ip()))/
                ICMPv6EchoRequest(seq=self.next_seq()), 1360, True))

        self.logger.info("Checking for the ICMPv6 Echo Request forwarded to TR1...")
        r1 = self.router(1).received(iface=1, seq=self.seq(), type=ICMPv6EchoRequest)
        assertEqual(1, len(r1), "expected the Echo Request to be tunnelled to TR1")

        self.logger.info("Sending packet too big message from TR1 to RUT.")
        self.node(1).send((
            IPv6(src=str(self.router(1).iface(1).global_ip()), dst=str(self.target(1).global_ip()))/
                ICMPv6PacketTooBig(mtu=1280)/
                    r1[0])[0:1280])

        self.logger.info("Checking that RUT has forwarded a Packet Too Big message to TN4...")
        r2 = self.node(4).received(type=ICMPv6PacketTooBig)
        assertEqual(1, len(r2), "expected the RUT to forward a Packet Too Big message to TN4")
        assertEqual(0x00, r2[0][ICMPv6PacketTooBig].code, "expected the Unreachable Node to have a Code field = 0")

        assertHasLayer(ICMPv6EchoRequest, r2[0], "expected the Hop Limit Exceeded message to contain the original Echo Request")
        assertEqual(self.seq(), r2[0][ICMPv6EchoRequest].seq, "expected the Hop Limit Exceeded message to contain the original Echo Request")
        assertEqual(ICMPv6EchoRequest, r2[0][ICMPv6PacketTooBig][2].__class__, "did not expect the error message to include the tunnel frame")
        
开发者ID:bobdoah,项目名称:veripy,代码行数:24,代码来源:packet_processing.py



注:本文中的veripy.util.pad函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python version.at_least函数代码示例发布时间:2022-05-26
下一篇:
Python models.IPAddress类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap