Example #1
0
    def create_LB_Rule(self, public_ip, network, vmarray, services=None):
        self.debug("Creating LB rule for IP address: %s" %
                   public_ip.ipaddress.ipaddress)
        objservices = None
        if services:
            objservices = services
        else:
            objservices = self.services["lbrule"]

        lb_rule = LoadBalancerRule.create(self.apiclient,
                                          objservices,
                                          ipaddressid=public_ip.ipaddress.id,
                                          accountid=self.account.name,
                                          networkid=network.id,
                                          vpcid=self.vpc.id,
                                          domainid=self.account.domainid)
        self.debug("Adding virtual machines %s and %s to LB rule" %
                   (vmarray[0], vmarray[1]))
        lb_rule.assign(self.apiclient, vmarray)

        self.debug("Adding NetworkACl rules to make NAT rule accessible")
        nwacl_nat = NetworkACL.create(self.apiclient,
                                      objservices,
                                      networkid=network.id,
                                      traffictype='Ingress')
        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
        return lb_rule
    def create_LB_Rule(self, public_ip, network, vmarray, services=None):
        self.debug("Creating LB rule for IP address: %s" %
                                        public_ip.ipaddress.ipaddress)
        objservices = None
        if services:
            objservices = services
        else:
            objservices = self.services["lbrule"]

        lb_rule = LoadBalancerRule.create(
                                    self.apiclient,
                                    objservices,
                                    ipaddressid=public_ip.ipaddress.id,
                                    accountid=self.account.name,
                                    networkid=network.id,
                                    vpcid=self.vpc.id,
                                    domainid=self.account.domainid
                                )
        self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray[0], vmarray[1]))
        lb_rule.assign(self.apiclient, vmarray)

        self.debug("Adding NetworkACl rules to make NAT rule accessible")
        nwacl_nat = NetworkACL.create(self.apiclient,
                                    objservices,
                                    networkid=network.id,
                                    traffictype='Ingress'
                                    )
        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
        return lb_rule
Example #3
0
 def create_ingress_rule(self, network, services=None):
     if not services:
         services = self.services["ssh_rule"]
     self.debug("Adding NetworkACL rules to make NAT rule accessible")
     nwacl_nat = NetworkACL.create(self.apiclient,
                                   services,
                                   networkid=network.id,
                                   traffictype='Ingress')
     return nwacl_nat
    def open_egress_to_world(self, network):
        self.debug("Adding Egress rules to network %s and %s to allow access to internet" % (network.name,self.services["http_rule"]))
        nwacl_internet_1 = NetworkACL.create(
                                        self.apiclient,
                                        networkid=network.id,
                                        services=self.services["http_rule"],
                                        traffictype='Ingress'
                                        )

        return nwacl_internet_1
 def create_ingress_rule(self, network, services=None):
     if not services:
         services = self.services["ssh_rule"]
     self.debug("Adding NetworkACL rules to make NAT rule accessible")
     nwacl_nat = NetworkACL.create(self.apiclient,
                                     services,
                                     networkid=network.id,
                                     traffictype='Ingress'
                                     )
     return nwacl_nat
Example #6
0
    def open_egress_to_world(self, network):
        self.debug("Adding Egress rules to network %s and %s to allow access to internet" % (network.name,self.services["http_rule"]))
        nwacl_internet_1 = NetworkACL.create(
                                        self.apiclient,
                                        networkid=network.id,
                                        services=self.services["http_rule"],
                                        traffictype='Ingress'
                                        )

        return nwacl_internet_1
Example #7
0
    def create_NatRule_For_VM(self, vm, public_ip, network):
        self.debug("Creatinng NAT rule in network for vm with public IP")
        nat_rule = NATRule.create(self.apiclient,
                                  vm,
                                  self.services["natrule"],
                                  ipaddressid=public_ip.ipaddress.id,
                                  openfirewall=False,
                                  networkid=network.id,
                                  vpcid=self.vpc.id)

        self.debug("Adding NetwrokACl rules to make NAT rule accessible")
        nwacl_nat = NetworkACL.create(self.apiclient,
                                      networkid=network.id,
                                      services=self.services["natrule"],
                                      traffictype='Ingress')
        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
        return nat_rule
    def create_NatRule_For_VM(self, vm, public_ip, network, services=None):
        self.debug("Creatinng NAT rule in network for vm with public IP")
        if not services:
            services = self.services["natrule"]
        nat_rule = NATRule.create(
            self.apiclient,
            vm,
            services,
            ipaddressid=public_ip.ipaddress.id,
            openfirewall=False,
            networkid=network.id,
            vpcid=self.vpc.id,
        )

        self.debug("Adding NetwrokACl rules to make NAT rule accessible")
        nwacl_nat = NetworkACL.create(self.apiclient, networkid=network.id, services=services, traffictype="Ingress")
        self.debug("nwacl_nat=%s" % nwacl_nat.__dict__)
        return nat_rule