public LocationBuilder setAccessSegment(final java.lang.Long value) { if (value != null) { checkAccessSegmentRange(value); } this._accessSegment = value; return this; }
public Location build() { return new LocationImpl(this); }
public LogicalLocation build() { return new LogicalLocationImpl(this); }
public LocationBuilder(Location base) { this._accessSegment = base.getAccessSegment(); this._accessType = base.getAccessType(); this._nodeRef = base.getNodeRef(); this._tpRef = base.getTpRef(); if (base instanceof LocationImpl) { LocationImpl impl = (LocationImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
epInputBuilder.setOwnFabric(fabricId); LogicalLocationBuilder llb = new LogicalLocationBuilder(); llb.setNodeId(lswId); llb.setTpId(lswLogicalPortId); epInputBuilder.setLogicalLocation(llb.build()); epInputBuilder.setGateway(gwIP); epInputBuilder.setIpAddress(epIP); LocationBuilder phyLoc = new LocationBuilder(FabMgrYangDataUtil.getPhyLocation( new TopologyId("ovsdb:1"), //TODO . hardcode is really bad! nodeIDStr, connIDStr)); phyLoc.setAccessType(accType); phyLoc.setAccessSegment(accSeg); epInputBuilder.setLocation(phyLoc.build()); LogicalLocationBuilder llb = new LogicalLocationBuilder(); llb.setNodeId(lswId); llb.setTpId(lswLogicalPortId); epInputBuilder.setLogicalLocation(llb.build());
public static Location getPhyLocation(TopologyId fabricId, String inventoryNodeIdStr, String inventoryNodeConnectorIdStr) { LocationBuilder locBuilder = new LocationBuilder(); /* * TODO: For now inventory nodeId and node connector id are directly mapped * to topology. This is a kludge. A formal approach would involve an * inventory-to-topology lookup. */ NodeId nodeId = new NodeId(inventoryNodeIdStr); TpId tpId = new TpId(inventoryNodeConnectorIdStr); locBuilder.setNodeRef(new NodeRef(createNodePath(fabricId, nodeId))); locBuilder.setTpRef(new TpRef(createTpPath(fabricId, nodeId, tpId))); return locBuilder.build(); } }
public LogicalLocationBuilder(LogicalLocation base) { this._nodeId = base.getNodeId(); this._tpId = base.getTpId(); if (base instanceof LogicalLocationImpl) { LogicalLocationImpl impl = (LogicalLocationImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (!Objects.equals(_nodeId, other.getNodeId())) { return false; if (!Objects.equals(_tpId, other.getTpId())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private LocationImpl(LocationBuilder base) { this._accessSegment = base.getAccessSegment(); this._accessType = base.getAccessType(); this._nodeRef = base.getNodeRef(); this._tpRef = base.getTpRef(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
LocationBuilder locBuilder = new LocationBuilder(input.getLocation()); epBuilder.setEndpointUuid(epId); epBuilder.setLocation(locBuilder.build());
private LogicalLocationImpl(LogicalLocationBuilder base) { this._nodeId = base.getNodeId(); this._tpId = base.getTpId(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
private void removeEndPointIId(final InstanceIdentifier<Endpoint> epIId, Endpoint ep) { if (ep.getLogicalLocation() != null) { @SuppressWarnings("unchecked") InstanceIdentifier<TerminationPoint> lportIid = (InstanceIdentifier<TerminationPoint>) ep.getLocation().getTpRef().getValue(); EpAccessPortRenderer portRender = EpAccessPortRenderer.newRenderer(databroker, lportIid); try { portRender.removeEpAccessPort(); } catch (Exception e) { LOG.error("", e); } } }
@SuppressWarnings("unchecked") public void createEpAccessPort(WriteTransaction trans, Endpoint ep, InstanceIdentifier<BdPort> bdPortIid) throws Exception { if (!calcLogicPortIId(ep)) { return; } InstanceIdentifier<Node> devNode = (InstanceIdentifier<Node>) ep.getLocation().getNodeRef().getValue(); Optional<TerminationPoint> optional = readTp(); InstanceIdentifier<UnderlayerPorts> iid = lportIid.augmentation(LogicalPortAugment.class) .child(LportAttribute.class) .child(UnderlayerPorts.class, new UnderlayerPortsKey(bdPortIid)); UnderlayerPortsBuilder builder = new UnderlayerPortsBuilder(); builder.setPortRef(bdPortIid); trans.put(LogicalDatastoreType.OPERATIONAL, iid, builder.build()); if (optional.isPresent()) { LogicalPortAugment lpAug = optional.get().getAugmentation(LogicalPortAugment.class); if (lpAug != null) { LportAttribute lattr = lpAug.getLportAttribute(); List<FabricAcl> acls = lattr.getFabricAcl(); if (acls != null && acls.isEmpty()) { cpAcls(acls, bdPortIid, trans); } } } }
public LocationBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.Location> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public LogicalLocationBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.endpoint.rev150930.endpoint.attributes.LogicalLocation> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
if (!Objects.equals(_accessSegment, other.getAccessSegment())) { return false; if (!Objects.equals(_accessType, other.getAccessType())) { return false; if (!Objects.equals(_nodeRef, other.getNodeRef())) { return false; if (!Objects.equals(_tpRef, other.getTpRef())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private void rendererEndpoint(Endpoint ep) throws Exception { // 1, create bridge domain port NodeId logicNode = ep.getLogicalLocation().getNodeId(); LogicSwitchContext switchCtx = fabricCtx.getLogicSwitchCtx(logicNode); if (switchCtx == null) { LOG.warn("There are no such switch's context.({})", logicNode.getValue()); return; } final int vlan = switchCtx.getVlan(); TpId destTpPort = ep.getLocation().getTpRef().getValue().firstKeyOf(TerminationPoint.class).getTpId(); InstanceIdentifier<Node> devIid = (InstanceIdentifier<Node>) ep.getLocation().getNodeRef().getValue(); DeviceContext devCtx = fabricCtx.getDeviceCtx(DeviceKey.newInstance(devIid)); String bdPortId = devCtx.createBdPort(vlan, destTpPort, ep.getLocation().getAccessType(), ep.getLocation().getAccessSegment()); InstanceIdentifier<BdPort> bdPortIid = devIid.augmentation(FabricCapableDevice.class) .child(Config.class).child(BdPort.class, new BdPortKey(bdPortId)); // 2, use bridge domain port to renderer logic port WriteTransaction trans = databroker.newWriteOnlyTransaction(); EpAccessPortRenderer portRender = EpAccessPortRenderer.newRenderer(databroker); portRender.createEpAccessPort(trans, ep, bdPortIid); MdSalUtils.wrapperSubmit(trans); } }