Matteo Scandolo | fcf842e | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 17 | from xos.logger import Logger, logging |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 18 | from services.metronetwork.models import * |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 19 | |
| 20 | logger = Logger(level=logging.INFO) |
| 21 | |
| 22 | |
| 23 | class MetroNetworkProvider(object): |
| 24 | networkdevice = None |
| 25 | |
| 26 | def __init__(self, networkdevice, **args): |
| 27 | self.networkdevice = networkdevice |
| 28 | pass |
| 29 | |
| 30 | # Methods to support for Synchronization - effectively list all interfaces |
| 31 | # |
| 32 | # Method for retrieving all network ports from the backend system |
| 33 | # Intended for use when doing a re-sync |
| 34 | def get_network_ports(self): |
| 35 | # Default method needs to be overriden |
| 36 | logger.debug("get_network_ports default called - should be overriden") |
| 37 | |
| 38 | # Method for getting a list of network ports to delete |
| 39 | # The default imnplementation just gets a list from the local DB |
| 40 | # Intended for use when doing a re-sync |
| 41 | def get_network_ports_for_deletion(self): |
| 42 | # Default method needs to be overriden |
| 43 | logger.debug("get_network_ports for deletion called - default is all ports in the db related to this id") |
| 44 | objs = [] |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 45 | return objs |
| 46 | |
| 47 | # Method for retrieving all network links from the backend system |
| 48 | # Includes Connectivity Objects |
| 49 | # Intended for use when doing a re-sync |
| 50 | def get_network_links(self): |
| 51 | # Default method needs to be overriden |
| 52 | logger.debug("get_network_links default called - should be overriden") |
| 53 | objs = [] |
| 54 | return objs |
| 55 | |
| 56 | # Method for getting a list of network links to delete |
| 57 | # Includes Connectivity Objects |
| 58 | # Intended for use when doing a re-sync |
| 59 | def get_network_links_for_deletion(self): |
| 60 | # Default method needs to be overriden |
| 61 | logger.debug("get_network_links for deletion called - should be overidden") |
| 62 | objs = [] |
| 63 | return objs |
| 64 | |
| 65 | # Methods to support Event Management - movement of changes from the Domain to XOS |
| 66 | # |
| 67 | # Method for Create and Update - Create and Update are together given the base design |
| 68 | def get_updated_or_created_objects(self): |
| 69 | # Default method needs to be overriden |
| 70 | logger.debug("get_updated_or_created_objects default called - should be overriden") |
| 71 | objs = [] |
| 72 | return objs |
| 73 | |
| 74 | # Method for Delete - Create and Update are together given the base design |
| 75 | def get_deleted_objects(self): |
| 76 | # Default method needs to be overriden |
| 77 | logger.debug("get_deleted_objects default called - should be overriden") |
| 78 | objs = [] |
| 79 | return objs |
| 80 | |
| 81 | # Methods to support Movement of changes from XOS into the Domain |
| 82 | # |
| 83 | # Method for creating point to point connectivity object |
| 84 | # |
| 85 | # obj - Connection object - with all configuration variables set |
| 86 | # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper |
| 87 | # states are assigned - if False the backend_status field |
| 88 | # should be assigned with the appropriate error code - in the case of True the |
| 89 | # backend_status will be assigned by the system and should be unassigned |
| 90 | |
| 91 | def create_point_to_point_connectivity(self, obj): |
| 92 | # Default method needs to be overriden |
| 93 | logger.debug("create_point_to_point_connectivity called - should be overriden") |
| 94 | return False |
| 95 | |
| 96 | # Method for deleting point to point connectivity object |
| 97 | # |
| 98 | # obj - Connection object |
| 99 | # returns - Boolean - indicating whether or not the request succeeded - in either case the Admin/Oper |
| 100 | # states are assigned - if False the backend_status field |
| 101 | # should be assigned with the appropriate error code - in the case of True the |
| 102 | # backend_status will be assigned by the system and should be unassigned |
| 103 | def delete_point_to_point_connectivity(self, obj): |
| 104 | # Default method needs to be overriden |
| 105 | logger.debug("delete_point_to_point_connectivity called - should be overriden") |
| 106 | return False |