4 class FlowClassifier(object):
5 def __init__(self
, name
):
6 self
.id = str(uuid
.uuid4())
7 self
.tenant_id
= "abcdefghijklmnopqrstuvwxyz123456"
10 self
.ethertype
= "IPv4"
12 self
.source_port_range_min
= 0
13 self
.source_port_range_max
= 0
14 self
.destination_port_range_min
= 0
15 self
.destination_port_range_max
= 0
16 self
.source_ip_prefix
= None
17 self
.destination_ip_prefix
= None
18 self
.logical_source_port
= ""
19 self
.logical_destination_port
= ""
20 self
.l7_parameters
= dict()
22 def create_dict(self
, compute
):
25 "tenant_id": self
.tenant_id
,
26 "description": self
.description
,
30 representation
["ethertype"] = self
.ethertype
32 representation
["protocol"] = self
.protocol
33 if self
.source_port_range_min
:
34 representation
["source_port_range_min"] = self
.source_port_range_min
35 if self
.source_port_range_max
:
36 representation
["source_port_range_max"] = self
.source_port_range_max
37 if self
.destination_port_range_min
:
38 representation
["destination_port_range_min"] = self
.destination_port_range_min
39 if self
.destination_port_range_max
:
40 representation
["destination_port_range_max"] = self
.destination_port_range_max
41 if self
.source_ip_prefix
:
42 representation
["source_ip_prefix"] = self
.source_ip_prefix
43 if self
.destination_ip_prefix
:
44 representation
["destination_ip_prefix"] = self
.destination_ip_prefix
45 if len(self
.logical_source_port
):
46 representation
["logical_source_port"] = self
.logical_source_port
47 if len(self
.logical_destination_port
):
48 representation
["logical_destination_port"] = self
.logical_destination_port
49 if len(self
.l7_parameters
.items()):
50 representation
["l7_parameters"] = self
.l7_parameters