blob: 2c30d79f4e8aa735c1edc282aa49decf6d30da6e [file] [log] [blame]
Rizwan Haider65baf552016-09-28 16:47:28 -04001import json
2from synchronizers.metronetwork.invokers.invoker import Invoker
3from services.metronetwork.models import NetworkEdgePort
4
5
6class NetworkEdgeToEdgePointInvoker(Invoker):
7 def __init__(self, **args):
8 pass
9
10 # Method for handline pre save semantics
11 # content here would be model specific but could include handling Many-to-Many relationship
12 # creation - which must occur post save
13 #
14 # obj - Whatever obj was just saved
15 # returns - None - this is a pure invoke() call, return type is None
16 #
17 def presave(self, obj):
18 # Now that the Ports are created - get a proper reference to them and update the
19 # src and dst fields
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050020 if hasattr(obj, 'uni1_createbuffer'):
21 uni1port = NetworkEdgePort.objects.get(pid=obj.uni1_createbuffer)
22 uni2port = NetworkEdgePort.objects.get(pid=obj.uni2_createbuffer)
23 obj.uni1 = uni1port
24 obj.uni2 = uni2port
Rizwan Haider65baf552016-09-28 16:47:28 -040025
26 # Method for handline post save semantics
27 # content here would be model specific but could include handling Many-to-Many relationship
28 # creation - which must occur post save
29 #
30 # obj - Whatever obj was just saved
31 # returns - N/A - this is a pure invoke() call
32 #
33 def postsave(self, obj):
34 pass