Beispiel #1
0
    def print_ofpt_multipart_reply_meter_config(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print('  Meter_Config(10): Flags: %s length: %s meter_id: %s' %
              (flags, msg.len, msg.meter_id.value))

        for band in msg.meter_band_header[0].band:
            if band.type == "drop":
                print(
                    'Band[type]: %s Band[len]: %s Band[rate]: %s Band[burst_size]: %s Band[pad]: %s'
                    % (band.type.value, band.len.value, band.rate.value,
                       band.burst_size.value, band.pad))
            if band.type == "dscp_remark":
                print(
                    'Band[type]: %s Band[len]: %s Band[rate]: %s Band[burst_size]: %s Band[prec]: %s '
                    'Band[pad]: %s' %
                    (band.type.value, band.len.value, band.rate.value,
                     band.burst_size.value, band.prec.value, band.pad))
            if band.type == "experimenter":
                print(
                    'Band[type]: %s Band[len]: %s Band[rate]: %s Band[burst_size]: %s Band[experimenter_id]: %s'
                    % (band.type.value, band.len.value, band.rate.value,
                       band.burst_size.value, band.experimenter_id.value))

        if len(msg.body) == 0:
            print('Multipart Reply Type Meter_config(10):\nNo meter_configs')
            return
Beispiel #2
0
    def print_ofpt_multipart_reply_experimenter(msg):
        """

        Args:
            msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print('  Experimenter(65535): Flags: %s Pad: %s Experimenter: %s' %
              (flags, msg.pad, msg.experimenter))
Beispiel #3
0
def print_ofpt_multipart_reply(msg):
    # Print main multipart_reply options
    string = 'Body - Type: %s Flags: %s Pad: %s'

    flags = green(dissector.get_multipart_reply_flags(msg.flags.value))

    print(string % (msg.multipart_type, flags, msg.pad))

    return 0
Beispiel #4
0
    def print_ofpt_multipart_reply_aggregate(msg):
        """

        Args:
            msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Aggregate(2): Flags: %s packet_count: %s, byte_count: %s flow_count: %s Pad: %s'
            % (flags, msg.packet_count, msg.byte_count, msg.flow_count,
               msg.pad))  # Is msg.stats included in 1.3?
Beispiel #5
0
    def print_ofpt_multipart_reply_description(msg):
        """

        Args:
                msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print('  Description(0): Flags: %s mfr_desc: %s hw_desc: %s'
              'sw_desc: %s serial_num: %s dp_desc: %s' %
              (flags, msg.mfr_desc, msg.hw_desc, msg.bsw_desc, msg.serial_num,
               msg.dp_desc))
Beispiel #6
0
    def print_ofpt_multipart_reply_group_features(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Group_Features(8): Flags: %s pad: %s capabilities: %s max_groups: %s actions: %s'
            % (flags, msg.pad, msg.capabilities, msg.max_groups, msg.actions))

        if len(msg.body) == 0:
            print('Multipart Reply Type Group_Features(8):\nNo group features')
            return
Beispiel #7
0
        def print_ofpt_multipart_reply_queue(queue):
            """

            Args:
                queue: OpenFlow message unpacked by python-openflow
            """
            flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
            port_no = green(dissector.get_phy_port_no(msg.port_no.value))
            print(
                '  Queue(5): Flags: %s port_no: %s queue_id: %s tx_bytes: %s tx_packets: %s tx_errors: %s'
                'duration_sec: %s duration_nsec: %s' %
                (flags, port_no, queue.queue_id, queue.tx_bytes,
                 queue.tx_packets, queue.tx_errors, queue.duration_sec,
                 queue.duration_nsec))
Beispiel #8
0
    def print_ofpt_multipart_reply_port_desc(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print('  Port_Desc(13): Flags: %s pad: %s' % (flags, msg.pad))

        if len(msg.body) == 0:
            print('Multipart Reply Type Port_Desc(13):\nNo port descriptions')
            return
        else:
            for port in msg.body:
                print_ofp_phy_port(port)
Beispiel #9
0
        def print_ofpt_multipart_reply_table_features(table_feature):
            """

            Args:
                table_feature: OpenFlow message unpacked by python-openflow
            """
            flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
            print(
                ' Table_Features(12): Flags: %s pad: %s length: %s table_id: %s name: %s metadata_match: %s'
                'metadata_write: %s config: %s max_entries: %s' %
                (flags, table_feature.pad, table_feature.length,
                 table_feature.table_id, table_feature.name,
                 table_feature.metadata_match, table_feature.metadata_write,
                 table_feature.config, table_feature.max_entries))
Beispiel #10
0
    def print_ofpt_multipart_reply_table(msg):
        """

        Args:
            msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print('  Table(3): Flags: %s table_id: %s pad: %s '
              ' active_count: %s lookup_count: %s matched_count: %s' %
              (flags, msg.table_id.value, msg.pad, msg.active_count.value,
               msg.lookup_count.value, msg.matched_count.value))

        if len(msg.body) == 0:
            print('Multipart Reply Type Table(3):\nNo Tables')
            return
Beispiel #11
0
    def print_ofpt_multipart_reply_port(port):
        """

        Args:
            msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Port(4): Flags: %s port_number: %s pad: %s rx_packets: %s tx_packets: %s rx_bytes: %s tx_bytes: %s'
            'rx_dropped: %s tx_dropped: %s rx_errors: %s tx_errors: %s rx_frame_err: %s rx_over_err: %s'
            'rx_crc_err: %s collisions: %s duration_sec: %s duration_nsec: %s\n'
            % (flags, red(port.port_no), port.pad, port.rx_packets,
               port.tx_packets, port.rx_bytes, port.tx_bytes, port.rx_dropped,
               port.tx_dropped, port.rx_errors, port.tx_errors,
               port.rx_frame_err, port.rx_over_err, port.rx_crc_err,
               port.collisions, port.duration_sec, port.duration_nsec))
Beispiel #12
0
    def print_ofpt_multipart_reply_meter_features(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Meter_Features(11): Flags: %s max_meter: %s band_type: %s capabilities: %s max_bands: %s'
            'max_color: %s pad: %s' %
            (flags, msg.max_meter, msg.band_type, msg.capabilities,
             msg.max_bands, msg.max_color, msg.pad))

        if len(msg.body) == 0:
            print(
                'Multipart Reply Type Meter_Features(11):\nNo meter features')
            return
Beispiel #13
0
    def print_ofpt_multipart_reply_group(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Group(6): Flags: %s length: %s pad: %s group_id: %s ref_count: %s '
            'pad: %s packet_count: %s byte_count: %s duration_sec: %s duration_nsec: %s'
            'bucket_counter[packet_count]: %s bucket_counter[byte_count]: %s' %
            (flags, msg.length, msg.pad, msg.group_id, msg.ref_count, msg.pad,
             msg.packet_count, msg.byte_count, msg.duration_sec,
             msg.duration_nsec, msg.buckets[0].packet_count.value,
             msg.buckets[0].byte_count.value))

        if len(msg.body) == 0:
            print('Multipart Reply Type: Group(6):\nNo groups')
            return
Beispiel #14
0
    def print_ofpt_multipart_reply_meter(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Meter(9): Flags: %s meter_id: %s len: %s pad: %s flow_count: %s'
            'packet_in_count: %s byte_in_count: %s duration_sec: %s duration_nsec: %s'
            'meter_band_stats[packet_band_count]: %s meter_band_stats[byte_band_count]: %s'
            % (flags, msg.meter_id, msg.len, msg.pad, msg.flow_count,
               msg.packet_in_count, msg.byte_in_count, msg.duration_sec,
               msg.duration_nsec,
               msg.meter_band_stats[0].packet_band_count.value,
               msg.meter_band_stats[0].byte_band_count.value))

        if len(msg.body) == 0:
            print('Multipart Reply Type Meter(9):\nNo meters')
            return
Beispiel #15
0
        def print_ofpt_multipart_reply_flow(flow):
            """

            Args:
                msg: OpenFlow message unpacked by python-openflow
            """
            flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
            print(
                '  Flow(1): Flags: %s Length: %s Table_id: %s Pad: %s duration_sec: %s, duration_nsec: %s,'
                ' priority: %s idle_timeout: %s hard_timeout: %s pad: %s cookie: %s packet_count: %s'
                ' byte_count: %s' %
                (flags, flow.length, flow.table_id, flow.pad,
                 flow.duration_sec, flow.duration_nsec, flow.priority,
                 flow.idle_timeout, flow.hard_timeout, flow.pad, flow.cookie,
                 flow.packet_count, flow.byte_count))

            print('Multipart_Reply ', end='')
            print_match_type(flow.match)
            print('Multipart_Reply ', end='')
            print_action(flow.actions)
Beispiel #16
0
    def print_ofpt_multipart_reply_group_desc(msg):
        """
            Args:
                    msg: OpenFlow message unpacked by python-openflow
        """
        flags = green(dissector.get_multipart_reply_flags(msg.flags.value))
        print(
            '  Group_Desc(7): Flags: %s length: %s pad: %s group_id: %s'
            'Bucket[length]: %s Bucket[weight]: %s Bucket[watch_port]: %s Bucket[watch_group]: %s'
            % (flags, msg.length, green(msg.group_id.value), msg.pad,
               msg.buckets[0].length.value, msg.buckets[0].weight.value,
               hex(msg.buckets[0].watch_port.value),
               hex(msg.buckets[0].watch_group.value)))

        print("Bucket[actions]:")
        for action in msg.buckets[0].actions:
            print_action(action)

        if len(msg.body) == 0:
            print('Multipart Reply Type Group_Desc(7):\nNo group_desc')
            return