コード例 #1
0
 def test_fastpath_packet_trace_protobuf_conversion(self):
     self.fastpath_packet_trace = RwFpathDYang.YangNotif_RwFpathD_FastpathPacketTrace(
     )
     self.fastpath_packet_trace.packet_info = bin(10203)
     pbuf = self.fastpath_packet_trace.to_pbuf()
     recreated_fastpath_packet_trace = RwFpathDYang.YangNotif_RwFpathD_FastpathPacketTrace(
     )
     recreated_fastpath_packet_trace.from_pbuf(pbuf)
     print "FpathPacketTrace           : ", self.fastpath_packet_trace
     print "Recreated FpathPacketTrace : ", recreated_fastpath_packet_trace
     self.assertEqual(self.fastpath_packet_trace.packet_info,
                      recreated_fastpath_packet_trace.packet_info)
コード例 #2
0
    def test_fastpath_packet_trace_xml_conversion(self):
        yang = rw_peas.PeasPlugin('yangmodel_plugin-c', 'YangModelPlugin-1.0')
        yang_model = yang.get_interface('Model')
        model = yang_model.alloc()
        module = yang_model.load_module(model, "rw-fpath-d")

        self.fastpath_packet_trace = RwFpathDYang.YangNotif_RwFpathD_FastpathPacketTrace(
        )
        self.fastpath_packet_trace.packet_info = bin(10203)

        # recreate a start using to_xml and from_xml methods
        xml_str = self.fastpath_packet_trace.to_xml(model)
        recreated_fastpath_packet_trace = RwFpathDYang.YangNotif_RwFpathD_FastpathPacketTrace(
        )
        recreated_fastpath_packet_trace.from_xml(model, xml_str)
        print "FpathPacketTrace           : ", self.fastpath_packet_trace
        print "Recreated FpathPacketTrace : ", recreated_fastpath_packet_trace
        self.assertEqual(self.fastpath_packet_trace.packet_info,
                         recreated_fastpath_packet_trace.packet_info)