public LogicalRouter build() { return new LogicalRouterImpl(this); }
public void removeLrFromCache(LogicalRouter lr) { this.lrStore.remove(lr.getUuid()); }
public LogicalRouterBuilder(LogicalRouter base) { if (base.getKey() == null) { this._key = new LogicalRouterKey( base.getUuid() ); this._uuid = base.getUuid(); } else { this._key = base.getKey(); this._uuid = _key.getUuid(); } this._description = base.getDescription(); this._name = base.getName(); this._port = base.getPort(); this._status = base.getStatus(); this._tenantId = base.getTenantId(); this._adminStateUp = base.isAdminStateUp(); this._public = base.isPublic(); if (base instanceof LogicalRouterImpl) { LogicalRouterImpl impl = (LogicalRouterImpl) 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.logical.faas.logical.routers.rev151013.logical.routers.container.logical.routers.LogicalRouter> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.logical.routers.rev151013.logical.routers.container.logical.routers.LogicalRouter>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private static boolean needToAddPublicPort(LogicalRouterBuilder logicalRouter) { if (logicalRouter.isPublic() != null && logicalRouter.isPublic().booleanValue()) { if (logicalRouter.getPort() == null) { return true; } for (Uuid portId : logicalRouter.getPort()) { Port port = readPortFromDs(logicalRouter.getTenantId(), portId); if (port != null && port.isIsPublic() != null && port.isIsPublic().booleanValue()) { return false; } } return true; } return false; }
public static void removeLogicalRouterFromDsIfExists(Uuid tenantId, Uuid routerId) { Optional<LogicalRouter> oldOptional = removeIfExists(UlnIidFactory.logicalRouterIid(tenantId, routerId)); /* * Make sure other logical network nodes links are updated as well */ if (oldOptional.isPresent()) { LogicalRouter router = oldOptional.get(); if (router.getPort() != null) { for (Uuid port : router.getPort()) { removePortFromDsIfExists(tenantId, port); } } } }
public static InstanceIdentifier<LogicalRouter> logicalRouterIid(Uuid tenantId, Uuid routerId) { return InstanceIdentifier.builder(TenantLogicalNetworks.class) .child(TenantLogicalNetwork.class, new TenantLogicalNetworkKey(tenantId)) .child(LogicalRouters.class) .child(LogicalRouter.class, new LogicalRouterKey(routerId)) .build(); }
public LogicalRouterBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.logical.routers.rev151013.logical.routers.container.logical.routers.LogicalRouter>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.logical.routers.rev151013.logical.routers.container.logical.routers.LogicalRouter> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
/** * Check if a logical router already has a cache entry. * @param lr - the logical router object. * @return true if found */ public boolean isLrAlreadyCached(LogicalRouter lr) { return this.lrStore.get(lr.getUuid()) != null; }
public LogicalRouterMappingInfo getLrMappingInfo(LogicalRouter lr) { return this.lrStore.get(lr.getUuid()); }
public void addRequestRemoveLr(LogicalRouter lr) { Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: removeLr: info is null"); return; } info.markDeleted(); }
/** * To cache an LogicalRouter. * @param lr to be cached. */ public void cacheLr(LogicalRouter lr) { if (!this.isLrAlreadyCached(lr)) { this.lrStore.put(lr.getUuid(), new LogicalRouterMappingInfo(lr)); } }
/** * Check if an logical router has been rendered. * @param lr - the logical router to be checked. * @param fabricId - the target fabric * @return true if rendered, false otherwise. */ public boolean isLrRendered(LogicalRouter lr, NodeId fabricId) { if (!this.isLrAlreadyCached(lr)) { return false; } return this.lrStore.get(lr.getUuid()).hasServiceBeenRenderedOnFabric(fabricId); }
public void addGatewayIpToLr(LogicalRouter lr, IpAddress gatewayIp) { Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: addLrLswEdgeToLr: info is null: {}", lrId.getValue()); return; } info.addGatewayIp(gatewayIp); }
public void addLrLswEdgeToLr(LogicalRouter lr, Edge edge) { Uuid edgeId = edge.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: addLrLswEdgeToLr: info is null: {}", lrId.getValue()); return; } info.addLrLswEdge(edgeId); }
public void removeLrLswEdgeFromLr(LogicalRouter lr, Edge edge) { Uuid edgeId = edge.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: removeLrLswEdgeFromLr: info is null: {}", lrId.getValue()); return; } info.removeLrLswEdge(edgeId); }
public void addSecurityRuleGroupsToLr(LogicalRouter lr, SecurityRuleGroups ruleGroups) { Uuid ruleGroupsId = ruleGroups.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: addSecurityRuleGroupsToLr: info is null: {}", lrId.getValue()); return; } info.addSecurityRuleGroups(ruleGroupsId); }
public void removeSecurityRuleGroupsFromLr(LogicalRouter lr, SecurityRuleGroups ruleGroups) { Uuid ruleGroupsId = ruleGroups.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: removeSecurityRuleGroupsFromLr: info is null: {}", lrId.getValue()); return; } info.removeSecurityRuleGroups(ruleGroupsId); }
public void removePortFromLr(LogicalRouter lr, Port port) { Uuid portId = port.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: removePortFromLr: info is null: {}", lrId.getValue()); return; } info.removePort(portId); }
public void addPortToLr(LogicalRouter lr, Port port) { Uuid portId = port.getUuid(); Uuid lrId = lr.getUuid(); LogicalRouterMappingInfo info = this.lrStore.get(lrId); if (info == null) { LOG.error("FABMGR: ERROR: addPortToLr: info is null: {}", lrId.getValue()); return; } info.addPort(portId); }
public static CreateLneLayer3Input createLneLayer3Input(Uuid tenantId, NodeId fabricId, LogicalRouter lr) { CreateLneLayer3InputBuilder builder = new CreateLneLayer3InputBuilder(); builder.setTenantId(new TenantId(tenantId.getValue())); builder.setLrUuid(UlnUtil.convertToYangUuid(lr.getUuid())); builder.setName(UlnUtil.convertToYangUuid(lr.getUuid()).getValue()); builder.setVfabricId(fabricId); return builder.build(); }