blob: 96fe6c9c66b41e44c53c2e75a864ad2450a10bc5 [file] [log] [blame]
Pier Ventre6b19e482016-11-07 16:21:04 -08001/*
2 * Copyright 2016-present Open Networking Laboratory
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
17package org.onosproject.segmentrouting.pwaas;
18
19import org.onosproject.net.config.NetworkConfigEvent;
20import org.onosproject.segmentrouting.SegmentRoutingManager;
21import org.onosproject.segmentrouting.config.PwaasConfig;
22import org.slf4j.Logger;
23import org.slf4j.LoggerFactory;
24
25/**
26 * Handles pwaas related events.
27 */
28public class L2TunnelHandler {
29 private static final Logger log = LoggerFactory.getLogger(L2TunnelHandler.class);
30 private static final String CONFIG_NOT_FOUND = "Pwaas config not found";
31 private static final String NOT_MASTER = "Not master controller";
32 private final SegmentRoutingManager srManager;
33
34 public L2TunnelHandler(SegmentRoutingManager srManager) {
35 this.srManager = srManager;
36 }
37
38 /**
39 * Processes Pwaas Config added event.
40 *
41 * @param event network config added event
42 */
43 public void processPwaasConfigAdded(NetworkConfigEvent event) {
44 log.info("Processing Pwaas CONFIG_ADDED");
45 PwaasConfig config = (PwaasConfig) event.config().get();
46 config.getPwIds().forEach(pwId -> {
47 log.info("{}", config.getPwDescription(pwId));
48 });
49 }
50
51 /**
52 * Processes Pwaas Config updated event.
53 *
54 * @param event network config updated event
55 */
56 public void processPwaasConfigUpdated(NetworkConfigEvent event) {
57 log.info("Processing Pwaas CONFIG_UPDATED");
58 PwaasConfig config = (PwaasConfig) event.config().get();
59 config.getPwIds().forEach(pwId -> {
60 log.info("{}", config.getPwDescription(pwId));
61 });
62 }
63
64 /**
65 * Processes Pwaas Config removed event.
66 *
67 * @param event network config removed event
68 */
69 public void processPwaasConfigRemoved(NetworkConfigEvent event) {
70 log.info("Processing Pwaas CONFIG_REMOVED");
71 PwaasConfig config = (PwaasConfig) event.config().get();
72 config.getPwIds().forEach(pwId -> {
73 log.info("{}", config.getPwDescription(pwId));
74 });
75 }
76}