@VisibleForTesting static Description createContractDescription(SecurityRule secRule, Neutron neutron) { if (NeutronMapperModule.isDebugEnabled()) { Optional<SecurityGroup> providerSecGroup = SecurityGroupUtils.findSecurityGroup(secRule.getSecurityGroupId(), neutron.getSecurityGroups()); if (!providerSecGroup.isPresent()) { LOG.error("Neutron Security Group with UUID {} does not exist but it is in {}", secRule.getSecurityGroupId().getValue(), secRule); throw new IllegalStateException( "Neutron Security Group with UUID " + secRule.getSecurityGroupId().getValue() + " does not exist."); } return new Description(CONTRACT_PROVIDER + SecurityGroupUtils.getNameOrUuid(providerSecGroup.get())); } return new Description(CONTRACT_PROVIDER + secRule.getSecurityGroupId()); }
@Deprecated private static @Nonnull L3Context createL3CtxFromRouter(Router router) { Name l3ContextName = null; if (!Strings.isNullOrEmpty(router.getName())) { l3ContextName = new Name(router.getName()); } return new L3ContextBuilder().setId(new L3ContextId(router.getUuid().getValue())) .setName(l3ContextName) .setDescription(new Description(MappingUtils.NEUTRON_ROUTER + router.getUuid().getValue())) .build(); }
@Override public CheckedFuture<Void, TransactionCommitFailedException> processSgtInfo(final TenantId tenantId, final List<SgtInfo> sgtInfos) { final WriteTransaction wTx = dataBroker.newWriteOnlyTransaction(); // create and write endpointgroups boolean createParent = true; for (SgtInfo sgtInfo : sgtInfos) { final Integer sgtValue = sgtInfo.getSgt().getValue(); final String sgtName = sgtInfo.getName(); LOG.trace("processing sgtInfo: {} - {}", sgtValue, sgtName); final EndpointGroupId epgId = new EndpointGroupId(sgtName); final InstanceIdentifier<EndpointGroup> epgPath = IidFactory.endpointGroupIid(tenantId, epgId); final EndpointGroup epg = new EndpointGroupBuilder() .setId(epgId) .setDescription(new Description("imported from ISE for sgt=" + sgtValue)) .setName(new Name(sgtName.replaceAll(" ", "_") + "--" + sgtValue)) .build(); wTx.put(LogicalDatastoreType.CONFIGURATION, epgPath, epg, createParent); createParent = false; } return wTx.submit(); } }