Search in sources :

Example 1 with HwvtepPhysicalPortAugmentationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.

the class TerminationPointCmd method transform.

@Override
public TerminationPoint transform(InstanceIdentifier<Node> nodePath, TerminationPoint src) {
    HwvtepPhysicalPortAugmentation augmentation = src.getAugmentation(HwvtepPhysicalPortAugmentation.class);
    if (augmentation == null) {
        return new TerminationPointBuilder(src).build();
    }
    String nodeIdVal = nodePath.firstKeyOf(Node.class).getNodeId().getValue();
    int idx = nodeIdVal.indexOf("/physicalswitch");
    if (idx > 0) {
        nodeIdVal = nodeIdVal.substring(0, idx);
        nodePath = HwvtepHAUtil.convertToInstanceIdentifier(nodeIdVal);
    }
    final InstanceIdentifier<Node> path = nodePath;
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder(src);
    tpBuilder.removeAugmentation(HwvtepPhysicalPortAugmentation.class);
    HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalPortAugmentationBuilder(augmentation);
    if (augmentation.getVlanBindings() != null && augmentation.getVlanBindings().size() > 0) {
        tpAugmentationBuilder.setVlanBindings(augmentation.getVlanBindings().stream().map(vlanBindings -> {
            VlanBindingsBuilder vlanBindingsBuilder = new VlanBindingsBuilder(vlanBindings);
            vlanBindingsBuilder.setLogicalSwitchRef(HwvtepHAUtil.convertLogicalSwitchRef(vlanBindings.getLogicalSwitchRef(), path));
            return vlanBindingsBuilder.build();
        }).collect(Collectors.toList()));
    }
    tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
    return tpBuilder.build();
}
Also used : HwvtepPhysicalPortAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) HwvtepPhysicalPortAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) VlanBindingsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindingsBuilder)

Example 2 with HwvtepPhysicalPortAugmentationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.

the class PhysicalSwitchHelper method updatePort.

public static void updatePort(String portName, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder, Map<Long, String> vlanBindings) {
    updateVlanBindings(vlanBindings, tpAugmentationBuilder);
    tpAugmentationBuilder.setPhysicalPortUuid(new Uuid(UUID.randomUUID().toString()));
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)

Example 3 with HwvtepPhysicalPortAugmentationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.

the class PhysicalSwitchHelper method updatePhysicalPortId.

public static void updatePhysicalPortId(String portName, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
    tpAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(portName));
    tpAugmentationBuilder.setHwvtepNodeDescription("");
}
Also used : HwvtepNodeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName)

Example 4 with HwvtepPhysicalPortAugmentationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder 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 5 with HwvtepPhysicalPortAugmentationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project genius by opendaylight.

the class HwvtepUtils method mergeVlanBindings.

/**
 * Merge vlan bindings in the transaction.
 *
 * @param transaction
 *            the transaction
 * @param physicalSwitchNodeId
 *            the physical switch node id
 * @param phyPortName
 *            the phy port name
 * @param vlanBindings
 *            the vlan bindings
 */
public static void mergeVlanBindings(final WriteTransaction transaction, final NodeId physicalSwitchNodeId, final String phyPortName, final List<VlanBindings> vlanBindings) {
    HwvtepPhysicalPortAugmentation phyPortAug = new HwvtepPhysicalPortAugmentationBuilder().setHwvtepNodeName(new HwvtepNodeName(phyPortName)).setVlanBindings(vlanBindings).build();
    final InstanceIdentifier<HwvtepPhysicalPortAugmentation> iid = HwvtepSouthboundUtils.createPhysicalPortInstanceIdentifier(physicalSwitchNodeId, phyPortName);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, iid, phyPortAug, true);
}
Also used : HwvtepPhysicalPortAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder) HwvtepNodeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName) HwvtepPhysicalPortAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation)

Aggregations

HwvtepPhysicalPortAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder)3 HwvtepNodeName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName)2 HwvtepPhysicalPortAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation)2 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)2 TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)2 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 VlanBindingsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindingsBuilder)1 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)1