Created on May 11, 2011
@author: peymankazemian
Bases: object
Cisco router parser. The generated transfer function will have three sub-layers: 1) from input port to fwd port: the packet will go through input acl, and vlan untag process 2) from fwd port to pre-output port: the forwarding table will find output port. but the output filter has not been applied yet. 3) from pre-output port to output port: this is where output acl filter is being done. So in order to see the ultimate faith of packet, we need to apply the tf.T() 3 consequative times.
looks at all the ports that has FWD mode for any vlan or appear as forwarding port of a forwarding rule, and assign a unique ID to them based on switch_id and a random port id. addition_ports will also be considered and assigned a unqie ID. This is for ports that exist on the switch but are not part of any vlan or output of forwarding rules.
After calling read_config_file(), read_spanning_tree_file() and read_route_file(), generate_port_ids(), and optionally optimize_forwarding_table(), this method may be called to generate transfer function rules corresponding to this box. The rules will be added to transfer function tf passed to the function.
Reads in the CISCO router config file and extracts access list entries and the ports/vlans they apply to.
Reads in the CISCO router “sh ip cef” output and extracts the forwarding table entries.
Reads in, the CISCO router “sh spanning-tree” output and extracts the list of ports that are in FWD mode for each vlan.
Sets the field in byte array arr to value. @arr: the bytearray to set the field bits to value. @field: ‘vlan’, ‘ip_src’, ‘ip_dst’, ‘ip_proto’, ‘tcp_src’, ‘tcp_dst’, ‘tcp_ctrl’ @value: an integer number, of the width equal to field’s width @right_mask: number of bits, from right that should be ignored when written to field. e.g. to have a /24 ip address, set mask to 8.
Created on Jun 1, 2011
@author: peymankazemian
ip_list is a list of ip address, subnet, next_hop,... of type (int,int,string,...) we compress it, and return a list of (int ip address,int subnet,next_hop,[ip_list_elem]) where list of ip_list_elem shows which input ipl_list elem is compressed to create the output entry and next_hop is a string indicating the next hop.
Created on Mar 7, 2012
@author: rcs
Bases: tuple
field_info(position, length)
Alias for field number 1
Alias for field number 0
The rules will be added to transfer function tf passed to the function.
HSA assumes uniquely labeled ports
Sets the field in byte array arr to value. @arr: the bytearray to set the field bits to value. @field: ‘eth_src’,’eth_dst’,’vlan’,’vlan_priority’,’eth_frame’,’ip_tos’,’ip_src’,’ip_dst’,’ip_proto’,’tcp_src’,’tcp_dst’ @value: an integer number, of the width equal to field’s width @right_mask: number of bits, from right that should be ignored when written to field. e.g. to have a /24 ip address, set mask to 8.