Search in sources :

Example 11 with TerminationPointBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder in project bgpcep by opendaylight.

the class NodeChangedListener method createTP.

private InstanceIdentifier<TerminationPoint> createTP(final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl, final ReadWriteTransaction trans) {
    final String url = "ip://" + addr.toString();
    final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
    final TerminationPointBuilder tpb = new TerminationPointBuilder();
    tpb.setKey(tpk).setTpId(tpk.getTpId());
    tpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
    final NodeKey nk = new NodeKey(new NodeId(url));
    final NodeBuilder nb = new NodeBuilder();
    nb.setKey(nk).setNodeId(nk.getNodeId());
    nb.setTerminationPoint(Lists.newArrayList(tpb.build()));
    if (sni != null) {
        nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(), inControl)));
    }
    final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.getKey());
    trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
    return nid.child(TerminationPoint.class, tpb.getKey());
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) IpBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.IpBuilder) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) IgpTerminationPointAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.IgpTerminationPointAttributesBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder) SupportingNodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) TerminationPoint1Builder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder)

Example 12 with TerminationPointBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder in project netvirt by opendaylight.

the class PhysicalSwitchHelper method buildTerminationPointForPhysicalSwitch.

public static TerminationPoint buildTerminationPointForPhysicalSwitch(InstanceIdentifier<Node> switchIid, String portName, WriteTransaction transaction, Map<Long, String> vlanBindingData) {
    TerminationPointKey tpKey = new TerminationPointKey(new TpId(portName));
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setKey(tpKey);
    tpBuilder.setTpId(tpKey.getTpId());
    switchIid.firstKeyOf(Node.class);
    InstanceIdentifier<TerminationPoint> tpPath = switchIid.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
    HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalPortAugmentationBuilder();
    buildTerminationPoint(tpAugmentationBuilder, portName, vlanBindingData);
    tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
    return tpBuilder.build();
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) HwvtepPhysicalPortAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 13 with TerminationPointBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder in project netvirt by opendaylight.

the class ElanBridgeManager method copyBridgeToConfig.

private void copyBridgeToConfig(Node brIntNode) {
    NodeBuilder bridgeNodeBuilder = new NodeBuilder(brIntNode);
    // termination points need to be masssaged to remove the ifindex field
    // which are not allowed in the config data store
    List<TerminationPoint> terminationPoints = brIntNode.getTerminationPoint();
    if (terminationPoints != null) {
        List<TerminationPoint> newTerminationPoints = new ArrayList<>();
        for (TerminationPoint tp : terminationPoints) {
            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
            TerminationPointBuilder tpBuilder = new TerminationPointBuilder(tp);
            if (ovsdbTerminationPointAugmentation != null) {
                OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(ovsdbTerminationPointAugmentation);
                tpAugmentationBuilder.setIfindex(null);
                tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
            }
            newTerminationPoints.add(tpBuilder.build());
        }
        bridgeNodeBuilder.setTerminationPoint(newTerminationPoints);
    }
    InstanceIdentifier<Node> brNodeIid = SouthboundUtils.createInstanceIdentifier(brIntNode.getNodeId());
    this.mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, brNodeIid, bridgeNodeBuilder.build());
}
Also used : OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) ArrayList(java.util.ArrayList) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 14 with TerminationPointBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder in project netvirt by opendaylight.

the class QosNeutronUtils method setPortBandwidthLimits.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void setPortBandwidthLimits(Port port, BandwidthLimitRules bwLimit, WriteTransaction writeConfigTxn) {
    if (!qosEosHandler.isQosClusterOwner()) {
        LOG.trace("Not Qos Cluster Owner. Ignoring setting bandwidth limits");
        return;
    }
    LOG.trace("Setting bandwidth limits {} on Port {}", port, bwLimit);
    BigInteger dpId = getDpnForInterface(port.getUuid().getValue());
    if (dpId.equals(BigInteger.ZERO)) {
        LOG.info("DPN ID for interface {} not found", port.getUuid().getValue());
        return;
    }
    OvsdbBridgeRef bridgeRefEntry = getBridgeRefEntryFromOperDS(dpId);
    Optional<Node> bridgeNode = MDSALUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntry.getValue().firstIdentifierOf(Node.class), dataBroker);
    TerminationPoint tp = SouthboundUtils.getTerminationPointByExternalId(bridgeNode.get(), port.getUuid().getValue());
    OvsdbTerminationPointAugmentation ovsdbTp = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(ovsdbTp.getName());
    tpAugmentationBuilder.setIngressPolicingRate(bwLimit.getMaxKbps().longValue());
    tpAugmentationBuilder.setIngressPolicingBurst(bwLimit.getMaxBurstKbps().longValue());
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setKey(tp.getKey());
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    try {
        if (writeConfigTxn != null) {
            writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, bridgeNode.get().getKey()).child(TerminationPoint.class, new TerminationPointKey(tp.getKey())), tpBuilder.build());
        } else {
            MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, bridgeNode.get().getKey()).child(TerminationPoint.class, new TerminationPointKey(tp.getKey())), tpBuilder.build());
        }
    } catch (Exception e) {
        LOG.error("Failure while setting BwLimitRule {} to port {}", bwLimit, port, e);
    }
}
Also used : TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) BigInteger(java.math.BigInteger) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) OvsdbBridgeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) ExecutionException(java.util.concurrent.ExecutionException)

Example 15 with TerminationPointBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder in project genius by opendaylight.

the class SouthboundUtils method addTerminationPoint.

private void addTerminationPoint(InstanceIdentifier<?> bridgeIid, String portName, int vlanId, Class<? extends InterfaceTypeBase> type, Map<String, String> options, IfTunnel ifTunnel) {
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(portName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    if (options != null) {
        List<Options> optionsList = new ArrayList<>();
        for (Map.Entry<String, String> entry : options.entrySet()) {
            OptionsBuilder optionsBuilder = new OptionsBuilder();
            optionsBuilder.setKey(new OptionsKey(entry.getKey()));
            optionsBuilder.setOption(entry.getKey());
            optionsBuilder.setValue(entry.getValue());
            optionsList.add(optionsBuilder.build());
        }
        tpAugmentationBuilder.setOptions(optionsList);
    }
    if (vlanId != 0) {
        tpAugmentationBuilder.setVlanMode(OvsdbPortInterfaceAttributes.VlanMode.Access);
        tpAugmentationBuilder.setVlanTag(new VlanId(vlanId));
    }
    if (bfdMonitoringEnabled(ifTunnel)) {
        if (isOfTunnel(ifTunnel)) {
            LOG.warn("BFD Monitoring not supported for OFTunnels");
        } else {
            List<InterfaceBfd> bfdParams = getBfdParams(ifTunnel);
            tpAugmentationBuilder.setInterfaceBfd(bfdParams);
        }
    }
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), portName);
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid));
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    batchingUtils.write(tpIid, tpBuilder.build(), BatchingUtils.EntityType.TOPOLOGY_CONFIG);
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) ArrayList(java.util.ArrayList) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) OptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) InterfaceBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd) Map(java.util.Map) HashMap(java.util.HashMap) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) OptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)

Aggregations

TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)17 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)12 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)7 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)6 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)6 ArrayList (java.util.ArrayList)5 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)3 BigInteger (java.math.BigInteger)2 HwvtepPhysicalLocatorAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation)2 OvsdbBridgeName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName)2 OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)2 InterfaceBfd (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd)2 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)2 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)2 SupportingNode (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode)2 SupportingNodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder)2 SupportingNodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey)2 TerminationPoint1Builder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder)2