Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 246286

Configure NAT Mapping using vCloud SDK

$
0
0

Hi All,

 

I am trying to configure NAT Mapping in one of my routed org n/w programatically using vCloud sdk.

 

code below :

 

          client.login(userId, password);

 

            for (ReferenceType adminOrgRef : client.getVcloudAdmin()
                    .getAdminOrgRefs()) {

 

                AdminOrganization adminOrg = AdminOrganization
                        .getAdminOrgByReference(client, adminOrgRef);

 

                for (ReferenceType adminOrgNetworkRef : adminOrg
                        .getAdminOrgNetworkRefs()) {
                   
                    AdminOrgNetwork adminOrgNetwork = AdminOrgNetwork
                            .getOrgNetworkByReference(client,adminOrgNetworkRef);
                   
                    System.out.println("Network Type : "+adminOrgNetwork.getResource().getName());
                   
                    if (adminOrgNetwork.getResource().getConfiguration() != null) {
                        if (adminOrgNetwork.getResource().getConfiguration().getFeatures() != null) {

 

            for (JAXBElement<? extends NetworkServiceType> jaxbElement : adminOrgNetwork.getResource().getConfiguration()
                                    .getFeatures().getNetworkService()) {

 

                if (jaxbElement.getValue() instanceof NatServiceType) {
                   
                    NatServiceType natSerType = (NatServiceType)jaxbElement.getValue();
               
                    NatPortForwardingRuleType npfruleType = new NatPortForwardingRuleType();
                   
                    npfruleType.setExternalIpAddress("10.98.127.20");
                    npfruleType.setExternalPort(80);
                    npfruleType.setInternalIpAddress("192.168.0.3");
                    npfruleType.setExternalPort(80);
                    npfruleType.setProtocol("TCP");
                   
                    NatRuleType newNtype = new NatRuleType();
                    newNtype.setPortForwardingRule(npfruleType);
                   
                    natSerType.set
                   
                    System.out.println("DONE");


Viewing all articles
Browse latest Browse all 246286

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>