blob: db651c3eb332929ff460db68c53aa83de1d0010c [file] [log] [blame]
Rizwan Haider30b33792016-08-18 02:11:18 -04001from xos.logger import Logger, logging
2from core.models.netw import *
3
4logger = Logger(level=logging.INFO)
5
6
7class MetroNetworkProvider(object):
8 networkdevice = None
9
10 def __init__(self, networkdevice, **args):
11 self.networkdevice = networkdevice
12 pass
13
14 # Methods to support for Synchronization - effectively list all interfaces
15 #
16 # Method for retrieving all network ports from the backend system
17 # Intended for use when doing a re-sync
18 def get_network_ports(self):
19 # Default method needs to be overriden
20 logger.debug("get_network_ports default called - should be overriden")
21
22 # Method for getting a list of network ports to delete
23 # The default imnplementation just gets a list from the local DB
24 # Intended for use when doing a re-sync
25 def get_network_ports_for_deletion(self):
26 # Default method needs to be overriden
27 logger.debug("get_network_ports for deletion called - default is all ports in the db related to this id")
28 objs = []
29 # ports = NetworkPort.objects.filter(networkdevice=self.networkdevice.id)
30 ports = NetworkPort.objects.all()
31 for port in ports:
32 objs.append(port)
33
34 return objs
35
36 # Method for retrieving all network links from the backend system
37 # Includes Connectivity Objects
38 # Intended for use when doing a re-sync
39 def get_network_links(self):
40 # Default method needs to be overriden
41 logger.debug("get_network_links default called - should be overriden")
42 objs = []
43 return objs
44
45 # Method for getting a list of network links to delete
46 # Includes Connectivity Objects
47 # Intended for use when doing a re-sync
48 def get_network_links_for_deletion(self):
49 # Default method needs to be overriden
50 logger.debug("get_network_links for deletion called - should be overidden")
51 objs = []
52 return objs
53
54 # Methods to support Event Management - movement of changes from the Domain to XOS
55 #
56 # Method for Create and Update - Create and Update are together given the base design
57 def get_updated_or_created_objects(self):
58 # Default method needs to be overriden
59 logger.debug("get_updated_or_created_objects default called - should be overriden")
60 objs = []
61 return objs
62
63 # Method for Delete - Create and Update are together given the base design
64 def get_deleted_objects(self):
65 # Default method needs to be overriden
66 logger.debug("get_deleted_objects default called - should be overriden")
67 objs = []
68 return objs
69
70 # Methods to support Movement of changes from XOS into the Domain
71 #
72 # Method for creating point to point connectivity object
73 #
74 # obj - Connection object - with all configuration variables set
75 # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper
76 # states are assigned - if False the backend_status field
77 # should be assigned with the appropriate error code - in the case of True the
78 # backend_status will be assigned by the system and should be unassigned
79
80 def create_point_to_point_connectivity(self, obj):
81 # Default method needs to be overriden
82 logger.debug("create_point_to_point_connectivity called - should be overriden")
83 return False
84
85 # Method for deleting point to point connectivity object
86 #
87 # obj - Connection object
88 # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper
89 # states are assigned - if False the backend_status field
90 # should be assigned with the appropriate error code - in the case of True the
91 # backend_status will be assigned by the system and should be unassigned
92 def delete_point_to_point_connectivity(self, obj):
93 # Default method needs to be overriden
94 logger.debug("delete_point_to_point_connectivity called - should be overriden")
95 return False