Revision b10e01d6 utils/proxy.py

b/utils/proxy.py
66 66
            flow.routes.append(route)
67 67
            device.routing_options.append(flow)
68 68
            route.name = route_obj.name
69
            match = route_obj.match
70
            if match.matchSource:
71
                route.match['source'].append(match.matchSource.address)
72
            if match.matchDestination:
73
                route.match['destination'].append(match.matchDestination.address)
74
            if match.matchprotocol:
75
                route.match['protocol'].append(match.matchprotocol.protocol)
76
            if match.matchport:
77
                for port in match.matchport.all():
78
                    route.match['port'].append(port.port)
79
            if match.matchDestinationPort:
80
                for port in match.matchDestinationPort.all():
81
                    route.match['destination-port'].append(port.port)
82
            if match.matchSourcePort:
83
                for port in match.matchSourcePort.all():
84
                    route.match['source-port'].append(port.port)
85
            if match.matchicmpcode:
86
                route.match['icmp-code'].append(match.matchicmpcode.icmp_code)
87
            if match.matchicmptype:
88
                route.match['icmp-type'].append(match.matchicmptype.icmp_type)
89
            if match.matchTcpFlag:
90
                route.match['tcp-flags'].append(match.matchTcpFlag.tcp_flags)
91
            if match.matchdscp:
92
                for dscp in match.matchdscp.all():
93
                    route.match['dscp'].append(dscp.dscp)
94
            if match.matchfragmenttype:
95
                route.match['fragment'].append(match.matchfragmenttype.fragmenttype)
96
            then = route_obj.then
97
            for thenaction in then.thenaction.all():
69
            if route_obj.source:
70
                route.match['source'].append(route_obj.source)
71
            if route_obj.destination:
72
                route.match['destination'].append(route_obj.destination)
73
            if route_obj.protocol:
74
                route.match['protocol'].append(route_obj.protocol)
75
            try:
76
                if route_obj.port:
77
                    for port in route_obj.port.all():
78
                        route.match['port'].append(port.port)
79
            except:
80
                pass
81
            try:
82
                if route_obj.destinationport:
83
                    for port in route_obj.destinationport.all():
84
                        route.match['destination-port'].append(port.port)
85
            except:
86
                pass
87
            try:
88
                if route_obj.sourceport:
89
                    for port in route_obj.sourceport.all():
90
                        route.match['source-port'].append(port.port)
91
            except:
92
                pass
93
            if route_obj.icmpcode:
94
                route.match['icmp-code'].append(route_obj.icmpcode)
95
            if route_obj.icmptype:
96
                route.match['icmp-type'].append(route_obj.icmptype)
97
            if route_obj.tcpflag:
98
                route.match['tcp-flags'].append(route_obj.tcpflag)
99
            try:
100
                if route_obj.dscp:
101
                    for dscp in route_obj.dscp.all():
102
                        route.match['dscp'].append(dscp.dscp)
103
            except:
104
                pass
105
            if route_obj.fragmenttype:
106
                route.match['fragment'].append(route_obj.fragmenttype)
107
            for thenaction in route_obj.then.all():
98 108
                if thenaction.action_value:
99 109
                    route.then[thenaction.action] = thenaction.action_value
100 110
                else:

Also available in: Unified diff