2 * Copyright (c) 2016 Cisco Systems Inc and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.activator;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
13 import org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.BandwidthProfileHelper;
14 import org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.InterfaceHelper;
15 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.AttachmentCircuitHelper;
16 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.L2vpnHelper;
17 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.PseudowireHelper;
18 import org.opendaylight.unimgr.mef.nrp.cisco.xr.l2vpn.helper.XConnectHelper;
19 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.asr9k.policymgr.cfg.rev150518.PolicyManager;
20 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.ifmgr.cfg.rev150730.InterfaceConfigurations;
21 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.L2vpn;
22 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.XconnectGroups;
23 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.XconnectGroup;
24 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.AttachmentCircuits;
25 import org.opendaylight.yang.gen.v1.http.cisco.com.ns.yang.cisco.ios.xr.l2vpn.cfg.rev151109.l2vpn.database.xconnect.groups.xconnect.group.p2p.xconnects.p2p.xconnect.Pseudowires;
26 import org.opendaylight.yang.gen.v1.urn.onf.core.network.module.rev160630.g_forwardingconstruct.FcPort;
28 import java.util.Optional;
30 import static org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.BandwidthProfileComposition.BwpApplicability.UNI;
31 import static org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.BandwidthProfileComposition.BwpDirection.EGRESS;
32 import static org.opendaylight.unimgr.mef.nrp.cisco.xr.common.helper.BandwidthProfileComposition.BwpDirection.INGRESS;
35 * Activator of VPLS-based L2 VPN using bridge connection on IOS-XR devices
37 * @author krzysztof.bijakowski@amartus.com
39 public class L2vpnBridgeActivator extends AbstractL2vpnActivator {
41 public L2vpnBridgeActivator(DataBroker dataBroker, MountPointService mountService) {
42 super(dataBroker, mountService);
46 protected Optional<PolicyManager> activateQos(String name, FcPort port) {
47 return new BandwidthProfileHelper(dataBroker, port)
48 .addPolicyMap(name, INGRESS, UNI)
49 .addPolicyMap(name, EGRESS, UNI)
54 protected InterfaceConfigurations activateInterface(FcPort port, FcPort neighbor, long mtu) {
55 return new InterfaceHelper()
56 .addInterface(port, Optional.empty(), true)
57 .addInterface(neighbor, Optional.empty(), true)
62 protected Pseudowires activatePseudowire(FcPort neighbor) {
63 return new PseudowireHelper().build();
67 protected XconnectGroups activateXConnect(String outerName, String innerName, FcPort portA, FcPort portZ, Pseudowires pseudowires) {
68 AttachmentCircuits attachmentCircuits = new AttachmentCircuitHelper()
73 XconnectGroup xconnectGroup = new XConnectHelper()
74 .appendXConnect(innerName, attachmentCircuits, pseudowires)
77 return XConnectHelper.createXConnectGroups(xconnectGroup);
81 protected L2vpn activateL2Vpn(XconnectGroups xconnectGroups) {
82 return L2vpnHelper.build(xconnectGroups);