commit | 75eef063c9db702f34eb9bc07482c8c86427e5c8 | [log] [tgz] |
---|---|---|
author | Andreas Pantelopoulos <andreas@opennetworking.org> | Thu Jan 11 07:53:48 2018 -0800 |
committer | Charles Chan <charles@opennetworking.org> | Thu Jan 11 19:08:20 2018 +0000 |
tree | 99b746c2ae9c0e275ca8dacd6119c9ae0e22ea9d | |
parent | 8e46aa70f7321a0fadac88f91a22f47ad37b576b [diff] |
Deploy existing pseudowires when segment routing is activated Change-Id: Id09deb8841a65ad6ee7840830e047123196fa26f
diff --git a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java index 62ad763..6d5d0b2 100644 --- a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java +++ b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -436,6 +436,8 @@ multicastRouteService.addListener(mcastListener); routeService.addListener(routeListener); + l2TunnelHandler.init(); + log.info("Started"); }
diff --git a/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java b/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java index bbcabbb..012628b 100644 --- a/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java +++ b/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java
@@ -143,6 +143,30 @@ } /** + * Deploys any pre-existing pseudowires in the configuration. + * Used by manager only in initialization. + */ + public void init() { + + PwaasConfig config = srManager.cfgService.getConfig(srManager.appId(), PwaasConfig.class); + if (config == null) { + return; + } + + log.info("Deploying existing pseudowires"); + + // gather pseudowires + Set<DefaultL2TunnelDescription> pwToAdd = config + .getPwIds() + .stream() + .map(config::getPwDescription) + .collect(Collectors.toSet()); + + // deploy pseudowires + deploy(pwToAdd); + } + + /** * Returns all L2 Policies. * * @return List of policies