Search in sources :

Example 1 with OpaqueNetworkSummary

use of com.vmware.vim25.OpaqueNetworkSummary in project photon-model by vmware.

the class VSphereNetworkEnumerationHelper method createSubnetStateForNetwork.

private static SubnetState createSubnetStateForNetwork(NetworkState networkState, EnumerationProgress enumerationProgress, NetworkOverlay net) {
    if (!VimNames.TYPE_NETWORK.equals(net.getId().getType()) && !VimNames.TYPE_OPAQUE_NETWORK.equals(net.getId().getType())) {
        return null;
    }
    SubnetState subnet = new SubnetState();
    subnet.documentSelfLink = UriUtils.buildUriPath(SubnetService.FACTORY_LINK, UriUtils.getLastPathSegment(networkState.documentSelfLink));
    subnet.id = subnet.name = net.getName();
    subnet.endpointLink = enumerationProgress.getRequest().endpointLink;
    AdapterUtils.addToEndpointLinks(subnet, enumerationProgress.getRequest().endpointLink);
    subnet.networkLink = networkState.documentSelfLink;
    subnet.tenantLinks = enumerationProgress.getTenantLinks();
    subnet.regionId = networkState.regionId;
    enumerationProgress.touchResource(subnet.documentSelfLink);
    CustomProperties.of(subnet).put(CustomProperties.MOREF, net.getId()).put(CustomProperties.TYPE, net.getId().getType());
    // Add NSX-T related properties to the subnet
    if (VimNames.TYPE_OPAQUE_NETWORK.equals(net.getId().getType())) {
        OpaqueNetworkSummary opaqueNetworkSummary = (OpaqueNetworkSummary) net.getSummary();
        CustomProperties.of(subnet).put(NsxProperties.OPAQUE_NET_ID, opaqueNetworkSummary.getOpaqueNetworkId()).put(NsxProperties.OPAQUE_NET_TYPE, opaqueNetworkSummary.getOpaqueNetworkType());
    }
    return subnet;
}
Also used : OpaqueNetworkSummary(com.vmware.vim25.OpaqueNetworkSummary) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState)

Example 2 with OpaqueNetworkSummary

use of com.vmware.vim25.OpaqueNetworkSummary in project photon-model by vmware.

the class VSphereNetworkEnumerationHelper method makeNetworkStateFromResults.

private static NetworkState makeNetworkStateFromResults(VSphereIncrementalEnumerationService service, EnumerationProgress enumerationProgress, NetworkOverlay net) {
    ComputeEnumerateResourceRequest request = enumerationProgress.getRequest();
    ComputeStateWithDescription parent = enumerationProgress.getParent();
    NetworkState state = new NetworkState();
    state.documentSelfLink = NetworkService.FACTORY_LINK + "/" + service.getHost().nextUUID();
    state.id = state.name = net.getName();
    state.endpointLink = enumerationProgress.getRequest().endpointLink;
    AdapterUtils.addToEndpointLinks(state, enumerationProgress.getRequest().endpointLink);
    state.regionId = enumerationProgress.getRegionId();
    state.resourcePoolLink = request.resourcePoolLink;
    state.adapterManagementReference = request.adapterManagementReference;
    state.authCredentialsLink = parent.description.authCredentialsLink;
    URI ref = parent.description.instanceAdapterReference;
    state.instanceAdapterReference = AdapterUriUtil.buildAdapterUri(ref.getPort(), VSphereUriPaths.DVS_NETWORK_SERVICE);
    CustomProperties custProp = CustomProperties.of(state).put(CustomProperties.MOREF, net.getId()).put(CustomProperties.DATACENTER_SELF_LINK, enumerationProgress.getDcLink()).put(CustomProperties.TYPE, net.getId().getType());
    if (net.getSummary() instanceof OpaqueNetworkSummary) {
        OpaqueNetworkSummary ons = (OpaqueNetworkSummary) net.getSummary();
        custProp.put(NsxProperties.OPAQUE_NET_ID, ons.getOpaqueNetworkId());
        custProp.put(NsxProperties.OPAQUE_NET_TYPE, ons.getOpaqueNetworkType());
    }
    if (net.getId().getType().equals(VimNames.TYPE_DVS)) {
        // dvs'es have a stable link
        state.documentSelfLink = buildStableDvsLink(net.getId(), request.endpointLink);
        custProp.put(DvsProperties.DVS_UUID, net.getDvsUuid());
    }
    VsphereEnumerationHelper.populateResourceStateWithAdditionalProps(state, enumerationProgress.getVcUuid());
    return state;
}
Also used : OpaqueNetworkSummary(com.vmware.vim25.OpaqueNetworkSummary) ComputeEnumerateResourceRequest(com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) URI(java.net.URI)

Aggregations

OpaqueNetworkSummary (com.vmware.vim25.OpaqueNetworkSummary)2 ComputeEnumerateResourceRequest (com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest)1 ComputeStateWithDescription (com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription)1 NetworkState (com.vmware.photon.controller.model.resources.NetworkService.NetworkState)1 SubnetState (com.vmware.photon.controller.model.resources.SubnetService.SubnetState)1 URI (java.net.URI)1