Last updated:
0 purchases
ovsportranges 0.1.2
# ovsportranges### DescriptionOpenflow requires port ranges to be defined as bitwise matches. This module provides an easy way to the port/mask ranges for a specified port range.As described in the [ovs-ofctl](http://www.openvswitch.org/support/dist-docs-2.5/ovs-ofctl.8.txt) documentation:> Bitwise match on TCP (or UDP or SCTP) source or destination> port. The port and mask are 16-bit numbers written in decimal> or in hexadecimal prefixed by 0x. Each 1-bit in mask requires> that the corresponding bit in port must match. Each 0-bit in> mask causes the corresponding bit to be ignored.It is recommended to only use this for large ranges that would require a large number of flows.### Installation`pip install ovsportranges`### Basic Usage``` pythonfrom ovsportrange import OvsPortsif __name__ == "__main__": ovsports = OvsPorts() ranges = ovsports.get_port_ranges(1000, 1999) for r in ranges: print("Port: {}, Bitmask: {}".format(r.port, r.bitmask))```### Output```textPort: 1000, Bitmask: 65528Port: 1008, Bitmask: 65520Port: 1024, Bitmask: 65024Port: 1536, Bitmask: 65280Port: 1792, Bitmask: 65408Port: 1920, Bitmask: 65472Port: 1984, Bitmask: 65520```
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.