Andy Bavier | 89a9542 | 2016-11-02 14:38:39 -0400 | [diff] [blame] | 1 | |
Matteo Scandolo | f5e1033 | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 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 | |
| 17 | |
Andy Bavier | 89a9542 | 2016-11-02 14:38:39 -0400 | [diff] [blame] | 18 | def handle(instance): |
| 19 | from core.models import Controller, ControllerSlice, ControllerNetwork, NetworkSlice |
| 20 | |
| 21 | networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)] |
| 22 | controller_networks = ControllerNetwork.objects.filter(network__in=networks, |
| 23 | controller=instance.node.site_deployment.controller) |
| 24 | |
| 25 | for cn in controller_networks: |
| 26 | if (cn.lazy_blocked): |
| 27 | cn.lazy_blocked=False |
| 28 | cn.backend_register = '{}' |
| 29 | cn.save() |