You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/04/15 10:05:01 UTC

[01/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Repository: cloudstack
Updated Branches:
  refs/heads/reporter 178a938ca -> 5c9978471 (forced update)


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/test/integration/component/test_bigswitch_bcf.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_bigswitch_bcf.py b/test/integration/component/test_bigswitch_bcf.py
new file mode 100644
index 0000000..c4cec8f
--- /dev/null
+++ b/test/integration/component/test_bigswitch_bcf.py
@@ -0,0 +1,776 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" P1 tests for BigSwitchBcf network Plugin
+"""
+#Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import *
+from marvin.lib.utils import (cleanup_resources,
+                              random_gen, validateList)
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             VpcOffering,
+                             Network,
+                             PublicIPAddress,
+                             FireWallRule,
+                             NATRule,
+                             Configurations)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template)
+from marvin.sshClient import SshClient
+from marvin.codes import PASS
+import subprocess
+import time
+
+
+class Services:
+    """Test BigSwitchBcf plugin
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "cloudstack@cloudmonkey.com",
+                                    "firstname": "cloudstack",
+                                    "lastname": "bob",
+                                    "username": "bobbuilder",
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 128,       # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'KVM',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "startport": 22,
+                                    "endport": 22,
+                                    "protocol": "TCP",
+                                    "cidrlist": '0.0.0.0/0',
+                                },
+                         "net1_net2_aclrule": {
+                                    "protocol": "ICMP",
+                                    "cidrlist": '0.0.0.0/0',
+                                },
+                         "big_switch_bcf_device": {
+                                "hostname": '10.212.1.104',
+                                "username": 'admin',
+                                "password": 'bsn',
+                                "retrycount": '4',
+                                "retryinterval": '60'
+                         },
+                         #services supported by Big Switch BCF for isolated networks.
+                         "network_offering": {
+                                    "name": 'BCF network offering (marvin)',
+                                    "displaytext": 'BCF (marvin)',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,SourceNat,Connectivity,StaticNat,PortForwarding,Firewall',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Dhcp" : 'VirtualRouter',
+                                            "Connectivity" : 'BigSwitchBcf',
+                                            "StaticNat" : 'VirtualRouter',
+                                            "SourceNat" : 'VirtualRouter',
+                                            "Firewall" : 'VirtualRouter'
+                                    },
+                         },
+                         "vpc_network_offering": {
+                                    "name": 'BCF VPC network offering (marvin)',
+                                    "displaytext": 'BCF VPC (marvin)',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,SourceNat,Connectivity,PortForwarding,StaticNat,NetworkACL',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "useVpc": 'on',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VpcVirtualRouter',
+                                            "SourceNat": 'VpcVirtualRouter',
+                                            "PortForwarding": 'VpcVirtualRouter',
+                                            "StaticNat": 'VpcVirtualRouter',
+                                            "NetworkACL": 'VpcVirtualRouter',
+                                            "Connectivity" : 'BigSwitchBcf'
+                                        },
+                                },
+                         "vpc_offering": {
+                                    "name": 'BCF VPC',
+                                    "displaytext": 'BCF VPC',
+                                    "supportedservices": 'Dhcp,SourceNat,PortForwarding,StaticNat,NetworkACL,Connectivity',
+                                },
+                         "vpc": {
+                                 "name": "TestVPC",
+                                 "displaytext": "TestVPC",
+                                 "cidr": '10.0.0.1/16'
+                                 },
+                         "network": {
+                                  "name": "BCF network",
+                                  "displaytext": "BCF network",
+                         },
+                         "ostype": 'CentOS 5.3 (64-bit)',
+                         "sleep": 60,
+                         "timeout": 10
+                    }
+
+class TestBigSwitchBcf(cloudstackTestCase):
+
+
+    @classmethod
+    def setUpClass(cls):
+        cls._cleanup = []
+        cls.testClient = super(TestBigSwitchBcf, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                           )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        # Get test parameters
+        cls.bigswitch_services = cls.services["big_switch_bcf_device"]
+        try:
+           # Get physical network
+           resp = listPhysicalNetworks.listPhysicalNetworksCmd()
+           resp.zoneid = cls.zone.id
+           physical_networks = cls.api_client.listPhysicalNetworks(resp)
+           if isinstance(physical_networks, list):
+               cls.debug("phy net %s" % physical_networks)
+               physical_network = physical_networks[1]
+
+           # Get bigswitch network service provider
+           resp = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
+           resp.name = 'BigSwitchBcf'
+           resp.physicalnetworkid = physical_network.id
+           nw_service_providers = cls.api_client.listNetworkServiceProviders(resp)
+           if isinstance(nw_service_providers, list):
+               bigswitch_provider = nw_service_providers[0]
+               cls.debug("net serv prov %s" % nw_service_providers)
+           else:
+               # Create bigswitch provider if not already existent
+               resp_add_nsp = addNetworkServiceProvider.addNetworkServiceProviderCmd()
+               resp_add_nsp.name = 'BigSwitchBcf'
+               resp_add_nsp.physicalnetworkid = physical_network.id
+               bigswitch_provider = cls.api_client.addNetworkServiceProvider(resp_add_nsp)
+               # add BCF controller
+               resp_add_device = addBigSwitchBcfDevice.addBigSwitchBcfDeviceCmd()
+               resp_add_device.physicalnetworkid = physical_network.id
+               resp_add_device.username = cls.bigswitch_services["username"]
+               resp_add_device.password = cls.bigswitch_services["password"]
+               resp_add_device.hostname = cls.bigswitch_services["hostname"]
+               resp_add_device.retrycount = cls.bigswitch_services["retrycount"]
+               resp_add_device.retryinterval = cls.bigswitch_services["retryinterval"]
+               cls.bigswitch = cls.api_client.addBigSwitchBcfDevice(resp_add_device)
+
+           if bigswitch_provider.state != 'Enabled':
+               cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
+               cmd.id = bigswitch_provider.id
+               cmd.state = 'Enabled'
+               cls.api_client.updateNetworkServiceProvider(cmd)
+
+           # Create non-VPC network offering
+           cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+           cls._cleanup.append(cls.network_offering)
+
+           cls.network_offering.update(cls.api_client, state='Enabled')
+
+           # Create VPC network offering
+           cls.vpc_network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["vpc_network_offering"],
+                                            conservemode=False
+                                            )
+           cls._cleanup.append(cls.vpc_network_offering)
+
+           cls.vpc_network_offering.update(cls.api_client, state='Enabled')
+
+           # Create VPC offering
+           cls.vpc_offering = VpcOffering.create(
+                                            cls.api_client,
+                                            cls.services["vpc_offering"]
+                                            )
+           cls._cleanup.append(cls.vpc_offering)
+
+           cls.vpc_offering.update(cls.api_client, state='Enabled')
+
+           # Create compute service offering
+           cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+           cls._cleanup.append(cls.service_offering)
+
+        except Exception as e:
+           cls.tearDownClass()
+           raise Exception ("Warning: Exception in setUpClass: %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+#        self._cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self._cleanup)
+            interval = Configurations.list(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = Configurations.list(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+
+    @attr(tags = ["advancedns"])
+    def test_network_bcf(self):
+        """Test basic workflow with BigSwitch BCF plugin
+           1. Create a non-VPC guest network
+           2. Create two VMs on the network
+           3. Add firewall rule to make virtual router pingable
+           4. Test ping to virtual router public IP
+           5. Add static NAT to vm_1, with firewall rule to allow ssh
+           6. Ssh to vm_1, ping vm_2 private address, ping google.com
+        """
+
+        self.debug("STEP 1: Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                      self.apiclient,
+                                      self.services["network"],
+                                      accountid=self.account.name,
+                                      domainid=self.account.domainid,
+                                      networkofferingid=self.network_offering.id,
+                                      zoneid=self.zone.id
+                                     )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("STEP 2: Deploying VMs in account: %s" % self.account.name)
+
+        vm_1 = VirtualMachine.create(
+                                     self.apiclient,
+                                     self.services["virtual_machine"],
+                                     accountid=self.account.name,
+                                     domainid=self.account.domainid,
+                                     serviceofferingid=self.service_offering.id,
+                                     networkids=[ str(self.network.id), ]
+                                    )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                               self.apiclient,
+                                               id=vm_1.id
+                                              )
+        self.debug(
+                   "Verify listVirtualMachines response for virtual machine: %s" \
+                   % vm_1.id
+                  )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                         vm_response.state,
+                         "Running",
+                         "VM state should be running after deployment"
+                        )
+
+        vm_2 = VirtualMachine.create(
+                                     self.apiclient,
+                                     self.services["virtual_machine"],
+                                     accountid=self.account.name,
+                                     domainid=self.account.domainid,
+                                     serviceofferingid=self.service_offering.id,
+                                     networkids=[ str(self.network.id), ]
+                                    )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                               self.apiclient,
+                                               id=vm_2.id
+                                              )
+
+        self.debug(
+                   "Verify listVirtualMachines response for virtual machine: %s" \
+                   % vm_2.id
+                  )
+
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("STEP 3: Add FW rule to allow source nat ping")
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.name,
+                                        domainid=self.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        #Create Firewall rules on source NAT
+        fw_rule_icmp = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='ICMP',
+                            cidrlist=["0.0.0.0/0",]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule_icmp.id)
+
+        self.debug("STEP 4: Trying to ping source NAT %s" % src_nat.ipaddress)
+        # User should be able to ping router via source nat ip
+        try:
+            self.debug("Trying to ping source NAT %s" % src_nat.ipaddress)
+            result = subprocess.call(
+                ['ping', '-c 1', src_nat.ipaddress])
+
+            self.debug("Ping result: %s" % result)
+            # if ping successful, then result should be 0
+            self.assertEqual(
+                             result,
+                             0,
+                             "Check if ping is successful or not"
+                            )
+        except Exception as e:
+            self.fail("Ping failed for source NAT %s (%s)"
+                      % (src_nat.ipaddress, e))
+
+        self.debug("STEP 5: Add static NAT to vm_1 with FW rule to allow SSH")
+        floating_ip_1 = PublicIPAddress.create(
+                                               self.apiclient,
+                                               accountid=self.account.name,
+                                               zoneid=self.zone.id,
+                                               domainid=self.account.domainid,
+                                               networkid=self.network.id,
+                                              )
+        self.debug("Associated %s with network %s" % (
+                                                      floating_ip_1.ipaddress,
+                                                      self.network.id
+                                                     )
+                  )
+        NATRule.create(
+                                  self.apiclient,
+                                  vm_1,
+                                  self.services["natrule"],
+                                  ipaddressid=floating_ip_1.ipaddress.id,
+                                  openfirewall=False,
+                                  networkid=self.network.id
+                                  )
+
+        # Should be able to SSH vm_1 via static nat, then ping vm_2 & Internet
+        try:
+            self.debug("STEP 6: SSH into vm_1: %s" % floating_ip_1)
+
+            ssh = vm_1.get_ssh_client(
+                                  ipaddress=floating_ip_1.ipaddress.ipaddress
+                                  )
+            self.debug("Ping vm_2 at %s" % vm_2.ipaddress)
+            # Ping vm_2
+            res_1 = ssh.execute("ping -c 1 %s" % vm_2.ipaddress)
+
+            self.debug("Ping to google.com from VM")
+            # Ping Internet
+            res_2 = ssh.execute("ping -c 1 www.google.com")
+
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+        except Exception as e:
+            self.fail("SSH Access failed: %s" % e)
+
+        self.debug("ping result1: %s" % res_1);
+        self.debug("ping result2: %s" % res_2);
+
+        result1 = str(res_1)
+        self.assertEqual(
+                         result1.count("1 received"),
+                         1,
+                         "Ping vm_2 from vm_1 should be successful"
+                         )
+
+        result2 = str(res_2)
+        self.assertEqual(
+                         result2.count("1 received"),
+                         1,
+                         "Ping Internet from vm_1 should be successful"
+                         )
+
+        # Deleting two test VMs
+        VirtualMachine.delete(vm_1, self.apiclient, expunge=True)
+        VirtualMachine.delete(vm_2, self.apiclient, expunge=True)
+
+        # Delete Network
+        Network.delete(self.network, self.apiclient)
+
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_vpc_network_bcf(self):
+        """Test VPC workflow with BigSwitch BCF plugin
+           1. Create a VPC with three networks
+           2. Create one VM on each of the three networks
+           3. Add firewall rule to make virtual router pingable
+           4. Test ping to virtual router public IP
+           5. Add static NAT to vm_1, with firewall rule to allow ssh
+           6. Add NAT rule to allow ping between net1 and net2
+           7. Ssh to vm_1, ping vm_2 private address, should succeed
+           8. continue ... ping vm_3 private address, should fail
+           9. continue ... ping Internet, should succeed
+        """
+
+        self.debug("STEP 1: Creating VPC with VPC offering: %s" %
+                            self.vpc_offering.id)
+        vpc = VPC.create(
+                         self.apiclient,
+                         self.services["vpc"],
+                         accountid=self.account.name,
+                         domainid=self.account.domainid,
+                         vpcofferingid=self.vpc_offering.id,
+                         zoneid=self.zone.id
+                        )
+        self.debug("Created VPC with ID: %s" % self.vpc.id)
+
+        # Creating network using the vpc network offering created
+        self.debug("Creating networks with vpc network offering: %s" %
+                    self.vpc_network_offering.id)
+        net1 = Network.create(
+                              self.apiclient,
+                              self.services["vpc_network"],
+                              accountid=self.account.name,
+                              domainid=self.account.domainid,
+                              networkofferingid=self.vpc_network_offering.id,
+                              zoneid=self.zone.id,
+                              gateway="10.0.100.1",
+                              vpcid=vpc.id
+                             )
+        self.debug("Created network with ID: %s" % net1.id)
+
+        net2 = Network.create(
+                              self.apiclient,
+                              self.services["vpc_network"],
+                              accountid=self.account.name,
+                              domainid=self.account.domainid,
+                              networkofferingid=self.vpc_network_offering.id,
+                              zoneid=self.zone.id,
+                              gateway="10.0.101.1",
+                              vpcid=vpc.id
+                             )
+        self.debug("Created network with ID: %s" % net2.id)
+
+        net3 = Network.create(
+                              self.apiclient,
+                              self.services["vpc_network"],
+                              accountid=self.account.name,
+                              domainid=self.account.domainid,
+                              networkofferingid=self.vpc_network_offering.id,
+                              zoneid=self.zone.id,
+                              gateway="10.0.102.0",
+                              vpcid=vpc.id
+                             )
+        self.debug("Created network with ID: %s" % net3.id)
+
+        self.debug("STEP 2: Deploying VMs in networks")
+
+        vm_1 = VirtualMachine.create(
+                                     self.apiclient,
+                                     self.services["virtual_machine"],
+                                     accountid=self.account.name,
+                                     domainid=self.account.domainid,
+                                     serviceofferingid=self.service_offering.id,
+                                     networkids=[ str(net1.id), ]
+                                    )
+        self.debug("Deployed VM in network: %s" % net1.id)
+        list_vm_response = VirtualMachine.list(
+                                               self.apiclient,
+                                               id=vm_1.id
+                                              )
+        self.debug(
+                   "Verify listVirtualMachines response for virtual machine: %s" \
+                   % vm_1.id
+                  )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                         vm_response.state,
+                         "Running",
+                         "VM state should be running after deployment"
+                        )
+
+        vm_2 = VirtualMachine.create(
+                                     self.apiclient,
+                                     self.services["virtual_machine"],
+                                     accountid=self.account.name,
+                                     domainid=self.account.domainid,
+                                     serviceofferingid=self.service_offering.id,
+                                     networkids=[ str(net2.id), ]
+                                    )
+        self.debug("Deployed VM in network: %s" % net2.id)
+        list_vm_response = VirtualMachine.list(
+                                               self.apiclient,
+                                               id=vm_2.id
+                                              )
+
+        self.debug(
+                   "Verify listVirtualMachines response for virtual machine: %s" \
+                   % vm_2.id
+                  )
+
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        vm_3 = VirtualMachine.create(
+                                     self.apiclient,
+                                     self.services["virtual_machine"],
+                                     accountid=self.account.name,
+                                     domainid=self.account.domainid,
+                                     serviceofferingid=self.service_offering.id,
+                                     networkids=[ str(net3.id), ]
+                                    )
+        self.debug("Deployed VM in network: %s" % net3.id)
+        list_vm_response = VirtualMachine.list(
+                                               self.apiclient,
+                                               id=vm_3.id
+                                              )
+        self.debug(
+                   "Verify listVirtualMachines response for virtual machine: %s" \
+                   % vm_3.id
+                  )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                         vm_response.state,
+                         "Running",
+                         "VM state should be running after deployment"
+                        )
+
+        self.debug("STEP 3: Add FW rule to allow source nat ping")
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        account=self.account.name,
+                                        domainid=self.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        vpcid=vpc.id
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        #Create Firewall rules on source NAT
+        fw_rule_icmp = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='ICMP',
+                            cidrlist=["0.0.0.0/0",]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule_icmp.id)
+
+        self.debug("STEP 4: Trying to ping source NAT %s" % src_nat.ipaddress)
+        # User should be able to ping router via source nat ip
+        try:
+            self.debug("Trying to ping source NAT %s" % src_nat.ipaddress)
+            result = subprocess.call(
+                ['ping', '-c 1', src_nat.ipaddress])
+
+            self.debug("Ping result: %s" % result)
+            # if ping successful, then result should be 0
+            self.assertEqual(
+                             result,
+                             0,
+                             "Check if ping is successful or not"
+                            )
+        except Exception as e:
+            self.fail("Ping failed for source NAT %s (%s)"
+                      % (src_nat.ipaddress, e))
+
+        self.debug("STEP 5: Add static NAT to vm_1 with FW rule to allow SSH")
+        floating_ip_1 = PublicIPAddress.create(
+                                               self.apiclient,
+                                               accountid=self.account.name,
+                                               zoneid=self.zone.id,
+                                               domainid=self.account.domainid,
+                                               networkid=net1.id,
+                                               vpcid=vpc.id
+                                              )
+        self.debug("Associated %s with network %s" % (
+                                                      floating_ip_1.ipaddress,
+                                                      net1.id
+                                                     )
+                  )
+        NATRule.create(
+                                  self.apiclient,
+                                  vm_1,
+                                  self.services["natrule"],
+                                  ipaddressid=floating_ip_1.ipaddress.id,
+                                  openfirewall=False,
+                                  networkid=net1.id,
+                                  vpcid=vpc.id
+                                  )
+
+        # Should be able to SSH vm_1 via static nat, then ping vm_2 & Internet
+        try:
+            self.debug("STEP 6: SSH into vm_1: %s" % floating_ip_1)
+
+            ssh = vm_1.get_ssh_client(
+                                  ipaddress=floating_ip_1.ipaddress.ipaddress
+                                  )
+#            self.debug("Ping vm_2 at %s" % vm_2.ipaddress)
+            # Ping to outsite world
+#            res_1 = ssh.execute("ping -c 1 %s" % vm_2.ipaddress)
+
+#            self.debug("Ping to google.com from VM")
+            # Ping to outsite world
+#            res_2 = ssh.execute("ping -c 1 www.google.com")
+
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+        except Exception as e:
+            self.fail("SSH Access failed: %s" % e)
+
+#        self.debug("ping result1: %s" % res_1);
+#        self.debug("ping result2: %s" % res_2);
+
+#        result1 = str(res_1)
+#        self.assertEqual(
+#                         result1.count("1 received"),
+#                         1,
+#                         "Ping vm_2 from vm_1 should be successful"
+#                         )
+
+#        result2 = str(res_2)
+#        self.assertEqual(
+#                         result2.count("1 received"),
+#                         1,
+#                         "Ping Internet from vm_1 should be successful"
+#                         )
+
+        # Deleting two test VMs
+        VirtualMachine.delete(vm_1, self.apiclient, expunge=True)
+        VirtualMachine.delete(vm_2, self.apiclient, expunge=True)
+
+        # Delete Network
+        Network.delete(self.network, self.apiclient)
+
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/tools/apidoc/gen_toc.py
----------------------------------------------------------------------
diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py
index 3d48bc5..e53d69d 100644
--- a/tools/apidoc/gen_toc.py
+++ b/tools/apidoc/gen_toc.py
@@ -138,7 +138,7 @@ known_categories = {
     'Tags': 'Resource tags',
     'NiciraNvpDevice': 'Nicira NVP',
     'BrocadeVcsDevice': 'Brocade VCS',
-    'BigSwitchVnsDevice': 'BigSwitch VNS',
+    'BigSwitchBcfDevice': 'BigSwitch BCF',
 	'NuageVsp': 'Nuage VSP',
     'AutoScale': 'AutoScale',
     'Counter': 'AutoScale',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/tools/eclipse/eclipse.epf
----------------------------------------------------------------------
diff --git a/tools/eclipse/eclipse.epf b/tools/eclipse/eclipse.epf
index d7795aa..e97f783 100644
--- a/tools/eclipse/eclipse.epf
+++ b/tools/eclipse/eclipse.epf
@@ -425,13 +425,13 @@
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
 /instance/org.eclipse.jdt.ui/cleanup.use_this_for_non_static_field_access=true
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-/instance/org.eclipse.wst.sse.core/task-tag-projects-already-scanned=cloud-agent,cloud-api,cloud-apidoc,cloud-awsapi,cloud-cli,cloud-client-ui,cloud-console-proxy,cloud-core,cloud-devcloud,cloud-devcloud-kvm,cloud-developer,cloud-engine,cloud-engine-api,cloud-engine-components-api,cloud-engine-compute,cloud-engine-network,cloud-engine-orchestration,cloud-engine-schema,cloud-engine-service,cloud-engine-storage,cloud-engine-storage-backup,cloud-engine-storage-image,cloud-engine-storage-imagemotion,cloud-engine-storage-integration-test,cloud-engine-storage-snapshot,cloud-engine-storage-volume,cloud-framework-events,cloud-framework-ipc,cloud-framework-rest,cloud-marvin,cloud-mom-rabbitmq,cloud-patches,cloud-plugin-acl-static-role-based,cloud-plugin-api-discovery,cloud-plugin-api-limit-account-based,cloud-plugin-console-proxy,cloud-plugin-example-dns-notifier,cloud-plugin-host-allocator-random,cloud-plugin-hypervisor-baremetal,cloud-plugin-hypervisor-kvm,cloud-plugin-hypervisor-ovm,cloud
 -plugin-hypervisor-simulator,cloud-plugin-hypervisor-ucs,cloud-plugin-hypervisor-vmware,cloud-plugin-hypervisor-xen,cloud-plugin-netapp,cloud-plugin-network-elb,cloud-plugin-network-f5,cloud-plugin-network-netscaler,cloud-plugin-network-nvp,cloud-plugin-network-ovs,cloud-plugin-network-srx,cloud-plugin-network-vns,cloud-plugin-planner-user-concentrated-pod,cloud-plugin-planner-user-dispersing,cloud-plugin-snmp-alerts,cloud-plugin-storage-allocator-random,cloud-plugin-storage-image-s3,cloud-plugin-storage-volume-default,cloud-plugin-storage-volume-solidfire,cloud-plugin-syslog-alerts,cloud-plugin-user-authenticator-ldap,cloud-plugin-user-authenticator-md5,cloud-plugin-user-authenticator-plaintext,cloud-plugin-user-authenticator-saml2,cloud-plugin-user-authenticator-sha256salted,cloud-server,cloud-testclient,cloud-tools,cloud-usage,cloud-utils,cloud-vmware-base,cloudstack,cloudstack-framework,cloudstack-plugins,xapi,cloud-framework-jobs,cloud-plugin-host-anti-affinity,cloud-plugin-net
 work-cisco-vnmc,cloud-plugin-network-midonet,cloud-secondary-storage,cloudstack-services,cloud-plugin-network-internallb,cloud-plugin-planner-implicit-dedication,cloudstack-service-console-proxy
-/instance/org.eclipse.jdt.debug.ui/org.eclipse.debug.ui.ExpressionView.org.eclipse.jdt.debug.ui.show_null_entries=true
-/instance/org.eclipse.jdt.ui/sp_cleanup.correct_indentation=false
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.format_source_code=true
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+/instance/org.eclipse.wst.sse.core/task-tag-projects-already-scanned=cloud-agent,cloud-api,cloud-apidoc,cloud-awsapi,cloud-cli,cloud-client-ui,cloud-console-proxy,cloud-core,cloud-devcloud,cloud-devcloud-kvm,cloud-developer,cloud-engine,cloud-engine-api,cloud-engine-components-api,cloud-engine-compute,cloud-engine-network,cloud-engine-orchestration,cloud-engine-schema,cloud-engine-service,cloud-engine-storage,cloud-engine-storage-backup,cloud-engine-storage-image,cloud-engine-storage-imagemotion,cloud-engine-storage-integration-test,cloud-engine-storage-snapshot,cloud-engine-storage-volume,cloud-framework-events,cloud-framework-ipc,cloud-framework-rest,cloud-marvin,cloud-mom-rabbitmq,cloud-patches,cloud-plugin-acl-static-role-based,cloud-plugin-api-discovery,cloud-plugin-api-limit-account-based,cloud-plugin-console-proxy,cloud-plugin-example-dns-notifier,cloud-plugin-host-allocator-random,cloud-plugin-hypervisor-baremetal,cloud-plugin-hypervisor-kvm,cloud-plugin-hypervisor-ovm,cloud
 -plugin-hypervisor-simulator,cloud-plugin-hypervisor-ucs,cloud-plugin-hypervisor-vmware,cloud-plugin-hypervisor-xen,cloud-plugin-netapp,cloud-plugin-network-elb,cloud-plugin-network-f5,cloud-plugin-network-netscaler,cloud-plugin-network-nvp,cloud-plugin-network-ovs,cloud-plugin-network-srx,cloud-plugin-network-bigswitch,cloud-plugin-planner-user-concentrated-pod,cloud-plugin-planner-user-dispersing,cloud-plugin-snmp-alerts,cloud-plugin-storage-allocator-random,cloud-plugin-storage-image-s3,cloud-plugin-storage-volume-default,cloud-plugin-storage-volume-solidfire,cloud-plugin-syslog-alerts,cloud-plugin-user-authenticator-ldap,cloud-plugin-user-authenticator-md5,cloud-plugin-user-authenticator-plaintext,cloud-plugin-user-authenticator-saml2,cloud-plugin-user-authenticator-sha256salted,cloud-server,cloud-testclient,cloud-tools,cloud-usage,cloud-utils,cloud-vmware-base,cloudstack,cloudstack-framework,cloudstack-plugins,xapi,cloud-framework-jobs,cloud-plugin-host-anti-affinity,cloud-plug
 in-network-cisco-vnmc,cloud-plugin-network-midonet,cloud-secondary-storage,cloudstack-services,cloud-plugin-network-internallb,cloud-plugin-planner-implicit-dedication,cloudstack-service-console-proxy
+/instance/org.eclipse.jdt.debug.ui/org.eclipse.debug.ui.ExpressionView.org.eclipse.jdt.debug.ui.show_null_entries=true
+/instance/org.eclipse.jdt.ui/sp_cleanup.correct_indentation=false
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.format_source_code=true
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
 /instance/org.eclipse.jdt.ui/cleanup.never_use_parentheses_in_expressions=true
 @org.eclipse.debug.core=3.7.100.v20120521-2012

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 3f5d73b..a967c90 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -328,7 +328,7 @@ dictionary = {
 'label.add.account.to.project': '<fmt:message key="label.add.account.to.project" />',
 'label.add.ACL': '<fmt:message key="label.add.ACL" />',
 'label.add.affinity.group': '<fmt:message key="label.add.affinity.group" />',
-'label.add.BigSwitchVns.device': '<fmt:message key="label.add.BigSwitchVns.device" />',
+'label.add.BigSwitchBcf.device': '<fmt:message key="label.add.BigSwitchBcf.device" />',
 'label.add.by.cidr': '<fmt:message key="label.add.by.cidr" />',
 'label.add.by': '<fmt:message key="label.add.by" />',
 'label.add.by.group': '<fmt:message key="label.add.by.group" />',
@@ -521,7 +521,7 @@ dictionary = {
 'label.default.use': '<fmt:message key="label.default.use" />',
 'label.default.view': '<fmt:message key="label.default.view" />',
 'label.delete.affinity.group': '<fmt:message key="label.delete.affinity.group" />',
-'label.delete.BigSwitchVns': '<fmt:message key="label.delete.BigSwitchVns" />',
+'label.delete.BigSwitchBcf': '<fmt:message key="label.delete.BigSwitchBcf" />',
 'label.delete.F5': '<fmt:message key="label.delete.F5" />',
 'label.delete': '<fmt:message key="label.delete" />',
 'label.delete.gateway': '<fmt:message key="label.delete.gateway" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/ui/dictionary2.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary2.jsp b/ui/dictionary2.jsp
index 3ecffac..7353a9d 100644
--- a/ui/dictionary2.jsp
+++ b/ui/dictionary2.jsp
@@ -452,6 +452,7 @@ under the License.
 'message.configuring.public.traffic': '<fmt:message key="message.configuring.public.traffic" />',
 'message.configuring.storage.traffic': '<fmt:message key="message.configuring.storage.traffic" />',
 'message.confirm.action.force.reconnect': '<fmt:message key="message.confirm.action.force.reconnect" />',
+'message.confirm.delete.BigSwitchBcf': '<fmt:message key="message.confirm.delete.BigSwitchBcf" />',
 'message.confirm.delete.F5': '<fmt:message key="message.confirm.delete.F5" />',
 'message.confirm.delete.BrocadeVcs': '<fmt:message key="message.confirm.delete.BrocadeVcs" />',
 'message.confirm.delete.NetScaler': '<fmt:message key="message.confirm.delete.NetScaler" />',
@@ -758,8 +759,9 @@ under the License.
 'label.nicira.nvp.details': '<fmt:message key="label.nicira.nvp.details" />',
 'label.added.brocade.vcs.switch': '<fmt:message key="label.added.brocade.vcs.switch" />',
 'label.brocade.vcs.details': '<fmt:message key="label.brocade.vcs.details" />',
-'label.added.new.bigswitch.vns.controller': '<fmt:message key="label.added.new.bigswitch.vns.controller" />',
-'label.bigswitch.vns.details': '<fmt:message key="label.bigswitch.vns.details" />',
+'label.added.new.bigswitch.bcf.controller': '<fmt:message key="label.added.new.bigswitch.bcf.controller" />',
+'label.bigswitch.bcf.details': '<fmt:message key="label.bigswitch.bcf.details" />',
+'label.bigswitch.bcf.nat': '<fmt:message key="label.bigswitch.bcf.nat" />',
 'label.dedicate': '<fmt:message key="label.dedicate" />',
 'label.dedicate.pod': '<fmt:message key="label.dedicate.pod" />',
 'label.pod.dedicated': '<fmt:message key="label.pod.dedicated" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 14c50f4..ceb0485 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -2286,7 +2286,7 @@
                                         //p.s. Netscaler is supported in both vpc and non-vpc
                                         if ($useVpc.is(':visible') && $useVpcCb.is(':checked')) { //*** vpc ***
                                             $optionsOfProviders.each(function(index) {
-                                                if ($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter' || $(this).val() == 'Netscaler'  || $(this).val() == 'NuageVsp' || $(this).val() == 'NuageVspVpc') {
+                                                if ($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter' || $(this).val() == 'Netscaler'  || $(this).val() == 'NuageVsp' || $(this).val() == 'NuageVspVpc' || $(this).val() == 'BigSwitchBcf') {
                                                     $(this).attr('disabled', false);
                                                 } else {
                                                     $(this).attr('disabled', true);
@@ -3578,25 +3578,29 @@
                                             });
                                             networkServiceObjs.push({
                                                 name: 'Gateway',
-                                                provider: [{name: 'VpcVirtualRouter'}]
+                                                provider: [{name: 'VpcVirtualRouter'},
+                                                           {name: 'BigSwitchBcf'}]
                                             });
                                             networkServiceObjs.push({
                                                 name: 'StaticNat',
                                                 provider: [
                                                        {name: 'VpcVirtualRouter'},
-                                                       {name: 'NuageVsp'}]
+                                                       {name: 'NuageVsp'},
+                                                       {name: 'BigSwitchBcf'}]
                                             });
                                             networkServiceObjs.push({
                                                 name: 'SourceNat',
                                                 provider: [
                                                        {name: 'VpcVirtualRouter'},
-                                                       {name: 'NuageVsp'}]
+                                                       {name: 'NuageVsp'},
+                                                       {name: 'BigSwitchBcf'}]
                                             });
                                             networkServiceObjs.push({
                                                 name: 'NetworkACL',
                                                 provider: [
                                                        {name: 'VpcVirtualRouter'},
-                                                       {name: 'NuageVsp'}]
+                                                       {name: 'NuageVsp'},
+                                                       {name: 'BigSwitchBcf'}]
                                             });
                                             networkServiceObjs.push({
                                                 name: 'PortForwarding',
@@ -3608,12 +3612,14 @@
                                             });
                                             networkServiceObjs.push({
                                                 name: 'Vpn',
-                                                provider: [{name: 'VpcVirtualRouter'}]
+                                                provider: [{name: 'VpcVirtualRouter'},
+                                                           {name: 'BigSwitchBcf'}]
                                             });
 
                                             networkServiceObjs.push({
                                                 name: 'Connectivity',
                                                 provider: [
+                                                    {name: 'BigSwitchBcf'},
                                                     {name: 'NiciraNvp'},
                                                     {name: 'Ovs'},
                                                     {name: 'JuniperContrailVpcRouter'},

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 126b1fc..b1aafaa 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -6024,14 +6024,14 @@
                             }
                         }
                     },
-                    // BigSwitch Vns provider detail view
-                    bigswitchVns: {
+                    // BigSwitch BCF provider detail view
+                    bigswitchBcf: {
                         type: 'detailView',
-                        id: 'bigswitchVnsProvider',
-                        label: 'label.bigswitchVns',
+                        id: 'bigswitchBcfProvider',
+                        label: 'label.bigswitchBcf',
                         viewAll: {
                             label: 'label.devices',
-                            path: '_zone.bigswitchVnsDevices'
+                            path: '_zone.bigswitchBcfDevices'
                         },
                         tabs: {
                             details: {
@@ -6047,31 +6047,43 @@
                                     }
                                 }],
                                 dataProvider: function (args) {
-                                    refreshNspData("BigSwitchVns");
+                                    refreshNspData("BigSwitchBcf");
                                     var providerObj;
                                     $(nspHardcodingArray).each(function () {
-                                        if (this.id == "bigswitchVns") {
+                                        if (this.id == "bigswitchBcf") {
                                             providerObj = this;
                                             return false;
                                         }
                                     });
                                     args.response.success({
                                         data: providerObj,
-                                        actionFilter: networkProviderActionFilter('bigswitchVns')
+                                        actionFilter: networkProviderActionFilter('bigswitchBcf')
                                     });
                                 }
                             }
                         },
                         actions: {
                             add: {
-                                label: 'label.add.BigSwitchVns.device',
+                                label: 'label.add.BigSwitchBcf.device',
                                 createForm: {
-                                    title: 'label.add.BigSwitchVns.device',
+                                    title: 'label.add.BigSwitchBcf.device',
                                     preFilter: function (args) {
                                     },
                                     fields: {
                                         host: {
-                                            label: 'label.ip.address'
+                                            label: 'label.host.name'
+                                        },
+                                        username: {
+                                            label: 'label.username'
+                                        },
+                                        password: {
+                                            label: 'label.password',
+                                            isPassword: true
+                                        },
+                                        nat: {
+                                                label: 'label.bigswitch.bcf.nat',
+                                                isBoolean: true,
+                                                isChecked: false
                                         },
                                         numretries: {
                                             label: 'label.numretries',
@@ -6080,14 +6092,14 @@
                                     }
                                 },
                                 action: function (args) {
-                                    if (nspMap[ "bigswitchVns"] == null) {
+                                    if (nspMap[ "bigswitchBcf"] == null) {
                                         $.ajax({
-                                            url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+                                            url: createURL("addNetworkServiceProvider&name=BigSwitchBcf&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
                                             dataType: "json",
                                             async: true,
                                             success: function (json) {
                                                 var jobId = json.addnetworkserviceproviderresponse.jobid;
-                                                var addBigSwitchVnsProviderIntervalID = setInterval(function () {
+                                                var addBigSwitchBcfProviderIntervalID = setInterval(function () {
                                                     $.ajax({
                                                         url: createURL("queryAsyncJobResult&jobId=" + jobId),
                                                         dataType: "json",
@@ -6096,18 +6108,18 @@
                                                             if (result.jobstatus == 0) {
                                                                 return; //Job has not completed
                                                             } else {
-                                                                clearInterval(addBigSwitchVnsProviderIntervalID);
+                                                                clearInterval(addBigSwitchBcfProviderIntervalID);
                                                                 if (result.jobstatus == 1) {
-                                                                    nspMap[ "bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
-                                                                    addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+                                                                    nspMap[ "bigswitchBcf"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
+                                                                    addBigSwitchBcfDevice(args, selectedPhysicalNetworkObj, "addBigSwitchBcfDevice", "addbigswitchbcfdeviceresponse", "bigswitchbcfdevice")
                                                                 } else if (result.jobstatus == 2) {
-                                                                    alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
+                                                                    alert("addNetworkServiceProvider&name=BigSwitchBcf failed. Error: " + _s(result.jobresult.errortext));
                                                                 }
                                                             }
                                                         },
                                                         error: function (XMLHttpResponse) {
                                                             var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                                                            alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
+                                                            alert("addNetworkServiceProvider&name=BigSwitchBcf failed. Error: " + errorMsg);
                                                         }
                                                     });
                                                 },
@@ -6115,12 +6127,12 @@
                                             }
                                         });
                                     } else {
-                                        addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+                                        addBigSwitchBcfDevice(args, selectedPhysicalNetworkObj, "addBigSwitchBcfDevice", "addbigswitchbcfdeviceresponse", "bigswitchbcfdevice")
                                     }
                                 },
                                 messages: {
                                     notification: function (args) {
-                                        return 'label.add.BigSwitchVns.device';
+                                        return 'label.add.BigSwitchBcf.device';
                                     }
                                 },
                                 notification: {
@@ -6131,7 +6143,7 @@
                                 label: 'label.enable.provider',
                                 action: function (args) {
                                     $.ajax({
-                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id + "&state=Enabled"),
+                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchBcf"].id + "&state=Enabled"),
                                         dataType: "json",
                                         success: function (json) {
                                             var jid = json.updatenetworkserviceproviderresponse.jobid;
@@ -6162,7 +6174,7 @@
                                 label: 'label.disable.provider',
                                 action: function (args) {
                                     $.ajax({
-                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id + "&state=Disabled"),
+                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchBcf"].id + "&state=Disabled"),
                                         dataType: "json",
                                         success: function (json) {
                                             var jid = json.updatenetworkserviceproviderresponse.jobid;
@@ -6193,7 +6205,7 @@
                                 label: 'label.shutdown.provider',
                                 action: function (args) {
                                     $.ajax({
-                                        url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id),
+                                        url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "bigswitchBcf"].id),
                                         dataType: "json",
                                         success: function (json) {
                                             var jid = json.deletenetworkserviceproviderresponse.jobid;
@@ -12709,11 +12721,11 @@
                     }
                 }
             },
-            bigswitchVnsDevices: {
-                id: 'bigswitchVnsDevices',
+            bigswitchBcfDevices: {
+                id: 'bigswitchBcfDevices',
                 title: 'label.devices',
                 listView: {
-                    id: 'bigswitchVnsDevices',
+                    id: 'bigswitchBcfDevices',
                     fields: {
                         hostname: {
                             label: 'label.bigswitch.controller.address'
@@ -12721,14 +12733,35 @@
                     },
                     actions: {
                         add: {
-                            label: 'label.add.BigSwitchVns.device',
+                            label: 'label.add.BigSwitchBcf.device',
                             createForm: {
-                                title: 'label.add.BigSwitchVns.device',
+                                title: 'label.add.BigSwitchBcf.device',
                                 preFilter: function (args) {
                                 },
                                 fields: {
                                     host: {
-                                        label: 'label.ip.address'
+                                        label: 'label.ip.address',
+                                        validation: {
+                                                     required: true
+                                                 }
+                                    },
+                                    username: {
+                                        label: 'label.username',
+                                        validation: {
+                                                     required: true
+                                                 }
+                                    },
+                                    password: {
+                                        label: 'label.password',
+                                        isPassword: true,
+                                        validation: {
+                                                     required: true
+                                                 }
+                                    },
+                                    nat: {
+                                                label: 'label.bigswitch.bcf.nat',
+                                                isBoolean: true,
+                                                isChecked: false
                                     },
                                     numretries: {
                                         label: 'label.numretries',
@@ -12737,14 +12770,14 @@
                                 }
                             },
                             action: function (args) {
-                                if (nspMap[ "bigswitchVns"] == null) {
+                                if (nspMap[ "bigswitchBcf"] == null) {
                                     $.ajax({
-                                        url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+                                        url: createURL("addNetworkServiceProvider&name=BigSwitchBcf&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
                                         dataType: "json",
                                         async: true,
                                         success: function (json) {
                                             var jobId = json.addnetworkserviceproviderresponse.jobid;
-                                            var addBigSwitchVnsProviderIntervalID = setInterval(function () {
+                                            var addBigSwitchBcfProviderIntervalID = setInterval(function () {
                                                 $.ajax({
                                                     url: createURL("queryAsyncJobResult&jobId=" + jobId),
                                                     dataType: "json",
@@ -12753,18 +12786,18 @@
                                                         if (result.jobstatus == 0) {
                                                             return;
                                                         } else {
-                                                            clearInterval(addBigSwitchVnsProviderIntervalID);
+                                                            clearInterval(addBigSwitchBcfProviderIntervalID);
                                                             if (result.jobstatus == 1) {
-                                                                nspMap[ "bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
-                                                                addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+                                                                nspMap[ "bigswitchBcf"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
+                                                                addBigSwitchBcfDevice(args, selectedPhysicalNetworkObj, "addBigSwitchBcfDevice", "addbigswitchbcfdeviceresponse", "bigswitchbcfdevice")
                                                             } else if (result.jobstatus == 2) {
-                                                                alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
+                                                                alert("addNetworkServiceProvider&name=BigSwitchBcf failed. Error: " + _s(result.jobresult.errortext));
                                                             }
                                                         }
                                                     },
                                                     error: function (XMLHttpResponse) {
                                                         var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                                                        alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
+                                                        alert("addNetworkServiceProvider&name=BigSwitchBcf failed. Error: " + errorMsg);
                                                     }
                                                 });
                                             },
@@ -12772,13 +12805,13 @@
                                         }
                                     });
                                 } else {
-                                    addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+                                    addBigSwitchBcfDevice(args, selectedPhysicalNetworkObj, "addBigSwitchBcfDevice", "addbigswitchbcfdeviceresponse", "bigswitchbcfdevice")
                                 }
                             },
                             
                             messages: {
                                 notification: function (args) {
-                                    return 'label.added.new.bigswitch.vns.controller';
+                                    return 'label.added.new.bigswitch.bcf.controller';
                                 }
                             },
                             notification: {
@@ -12788,7 +12821,7 @@
                     },
                     dataProvider: function (args) {
                         $.ajax({
-                            url: createURL("listBigSwitchVnsDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+                            url: createURL("listBigSwitchBcfDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
                             data: {
                                 page: args.page,
                                 pageSize: pageSize
@@ -12796,7 +12829,7 @@
                             dataType: "json",
                             async: false,
                             success: function (json) {
-                                var items = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice;
+                                var items = json.listbigswitchbcfdeviceresponse.bigswitchbcfdevice;
                                 args.response.success({
                                     data: items
                                 });
@@ -12804,25 +12837,25 @@
                         });
                     },
                     detailView: {
-                        name: 'label.bigswitch.vns.details',
+                        name: 'label.bigswitch.bcf.details',
                         actions: {
                             'remove': {
-                                label: 'label.delete.BigSwitchVns',
+                                label: 'label.delete.BigSwitchBcf',
                                 messages: {
                                     confirm: function (args) {
-                                        return 'message.confirm.delete.BigSwitchVns';
+                                        return 'message.confirm.delete.BigSwitchBcf';
                                     },
                                     notification: function (args) {
-                                        return 'label.delete.BigSwitchVns';
+                                        return 'label.delete.BigSwitchBcf';
                                     }
                                 },
                                 action: function (args) {
                                     $.ajax({
-                                        url: createURL("deleteBigSwitchVnsDevice&vnsdeviceid=" + args.context.bigswitchvnsDevices[0].vnsdeviceid),
+                                        url: createURL("deleteBigSwitchBcfDevice&bcfdeviceid=" + args.context.bigswitchBcfDevices[0].bcfdeviceid),
                                         dataType: "json",
                                         async: true,
                                         success: function (json) {
-                                            var jid = json.deletebigswitchvnsdeviceresponse.jobid;
+                                            var jid = json.deletebigswitchbcfdeviceresponse.jobid;
                                             args.response.success({
                                                 _custom: {
                                                     jobId: jid
@@ -12840,20 +12873,20 @@
                             details: {
                                 title: 'label.details',
                                 fields:[ {
-                                    vnsdeviceid: {
+                                    bcfdeviceid: {
                                         label: 'label.id'
                                     },
                                     hostname: {
-                                        label: 'label.ip.address'
+                                        label: 'label.host.name'
                                     }
                                 }],
                                 dataProvider: function (args) {
                                     $.ajax({
-                                        url: createURL("listBigSwitchVnsDevices&vnsdeviceid=" + args.context.bigswitchVnsDevices[0].vnsdeviceid),
+                                        url: createURL("listBigSwitchBcfDevices&bcfdeviceid=" + args.context.bigswitchBcfDevices[0].bcfdeviceid),
                                         dataType: "json",
                                         async: true,
                                         success: function (json) {
-                                            var item = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice[0];
+                                            var item = json.listbigswitchbcfdeviceresponse.bigswitchbcfdevice[0];
                                             args.response.success({
                                                 data: item
                                             });
@@ -20159,11 +20192,14 @@
         });
     }
     
-    function addBigSwitchVnsDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) {
+    function addBigSwitchBcfDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) {
         var array1 =[];
         array1.push("&physicalnetworkid=" + physicalNetworkObj.id);
         array1.push("&hostname=" + todb(args.data.host));
-        
+        array1.push("&username=" + args.data.username);
+        array1.push("&password=" + args.data.password);
+        array1.push("&nat=" + (args.data.nat == 'on' ? "true": "false"));
+
         $.ajax({
             url: createURL(apiCmd + array1.join("")),
             dataType: "json",
@@ -20905,8 +20941,8 @@
 							case "BrocadeVcs":
                             nspMap[ "brocadeVcs"] = items[i];
                             break;
-                            case "BigSwitchVns":
-                            nspMap[ "bigswitchVns"] = items[i];
+                            case "BigSwitchBcf":
+                            nspMap[ "bigswitchBcf"] = items[i];
                             break;
                             case "Ovs":
                             nspMap[ "Ovs"] = items[i];
@@ -20947,9 +20983,9 @@
             state: nspMap.brocadeVcs ? nspMap.brocadeVcs.state: 'Disabled'
         },
         {
-            id: 'bigswitchVns',
-            name: 'BigSwitch Vns',
-            state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state: 'Disabled'
+            id: 'bigswitchBcf',
+            name: 'BigSwitch BCF',
+            state: nspMap.bigswitchBcf ? nspMap.bigswitchBcf.state: 'Disabled'
         },
         {
             id: 'BaremetalDhcpProvider',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/ui/scripts/ui-custom/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js
index 02552f9..8344d95 100644
--- a/ui/scripts/ui-custom/zoneWizard.js
+++ b/ui/scripts/ui-custom/zoneWizard.js
@@ -713,8 +713,8 @@
                                 value: 'STT'
                             }).html('STT'),
                             $('<option>').attr({
-                                value: 'VNS'
-                            }).html('VNS'),
+                                value: 'BCF_SEGMENT'
+                            }).html('BCF_SEGMENT'),
                             $('<option>').attr({
                                 value: 'SSP'
                             }).html('SSP'),


[33/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
vmware-base: get vsessiontimeout from client class

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 4d9a94ce6956e61882b0fd7f15c1ec66d6419135)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/04dccda3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/04dccda3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/04dccda3

Branch: refs/heads/reporter
Commit: 04dccda3f0b2c8d9c5ec9afafba5d70edabaa87d
Parents: a70947f
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:37:13 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:48:11 2015 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/mo/VirtualMachineMO.java    | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/04dccda3/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 2798d54..ac5b414 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -458,6 +458,7 @@ public class VirtualMachineMO extends BaseMO {
 
     public boolean createSnapshot(String snapshotName, String snapshotDescription, boolean dumpMemory, boolean quiesce) throws Exception {
 
+        long apiTimeout = _context.getVimClient().getVcenterSessionTimeout();
         ManagedObjectReference morTask = _context.getService().createSnapshotTask(_mor, snapshotName, snapshotDescription, dumpMemory, quiesce);
 
         boolean result = _context.getVimClient().waitForTask(morTask);
@@ -467,7 +468,7 @@ public class VirtualMachineMO extends BaseMO {
             ManagedObjectReference morSnapshot = null;
             // We still need to wait until the object appear in vCenter
             long startTick = System.currentTimeMillis();
-            while (System.currentTimeMillis() - startTick < 10000) {
+            while (System.currentTimeMillis() - startTick < apiTimeout) {
                 morSnapshot = getSnapshotMor(snapshotName);
                 if (morSnapshot != null) {
                     break;
@@ -479,9 +480,11 @@ public class VirtualMachineMO extends BaseMO {
                 }
             }
 
-            if (morSnapshot == null)
-                s_logger.error("We've been waiting for over 10 seconds for snapshot MOR to be appearing in vCenter after CreateSnapshot task is done, but it is still not there?!");
-
+            if (morSnapshot == null) {
+                s_logger.error("We've been waiting for over " + apiTimeout + " milli seconds for snapshot MOR to be appearing in vCenter after CreateSnapshot task is done, but it is still not there?!");
+                return false;
+            }
+            s_logger.debug("Waited for " + (System.currentTimeMillis() - startTick) + " seconds for snapshot object [" + snapshotName + "] to appear in vCenter.");
             return true;
         } else {
             s_logger.error("VMware createSnapshot_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
@@ -1751,8 +1754,15 @@ public class VirtualMachineMO extends BaseMO {
         }
     }
 
+  public String getGuestId() throws Exception {
+    return (String)_context.getVimClient().getDynamicProperty(_mor, "config.guestId");
+  }
+
     public GuestOsDescriptor getGuestOsDescriptor(String guestOsId) throws Exception {
         GuestOsDescriptor guestOsDescriptor = null;
+        if (guestOsId == null) {
+            guestOsId = getGuestId();
+        }
         ManagedObjectReference vmEnvironmentBrowser = _context.getVimClient().getMoRefProp(_mor, "environmentBrowser");
         VirtualMachineConfigOption vmConfigOption = _context.getService().queryConfigOption(vmEnvironmentBrowser, null, null);
         List<GuestOsDescriptor> guestDescriptors = vmConfigOption.getGuestOSDescriptor();


[11/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Merge branch 'master' of https://github.com/remibergsma/cloudstack


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/da233c7b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/da233c7b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/da233c7b

Branch: refs/heads/reporter
Commit: da233c7bf180dac3f8e940e90c232642e2ab06c1
Parents: d8eb2e5 7bce656
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Fri Apr 10 15:08:01 2015 -0500
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Fri Apr 10 15:08:01 2015 -0500

----------------------------------------------------------------------
 scripts/vm/hypervisor/kvm/kvmheartbeat.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[23/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
rats are rodents

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/21e18b1e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/21e18b1e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/21e18b1e

Branch: refs/heads/reporter
Commit: 21e18b1e60363f24b20410475f466fd150d4adef
Parents: d3a98ab
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 21:04:08 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 21:04:08 2015 +0200

----------------------------------------------------------------------
 .../network/bigswitch/BigSwitchBcfUtilsTest.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/21e18b1e/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
index 3433f8c..97dd268 100644
--- a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package com.cloud.network.bigswitch;
 
 import static org.junit.Assert.assertEquals;


[05/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
deleted file mode 100644
index 223972e..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
+++ /dev/null
@@ -1,309 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.resource;
-
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.IAgentControl;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.CreateVnsNetworkAnswer;
-import com.cloud.agent.api.CreateVnsNetworkCommand;
-import com.cloud.agent.api.CreateVnsPortAnswer;
-import com.cloud.agent.api.CreateVnsPortCommand;
-import com.cloud.agent.api.DeleteVnsNetworkAnswer;
-import com.cloud.agent.api.DeleteVnsNetworkCommand;
-import com.cloud.agent.api.DeleteVnsPortAnswer;
-import com.cloud.agent.api.DeleteVnsPortCommand;
-import com.cloud.agent.api.MaintainAnswer;
-import com.cloud.agent.api.MaintainCommand;
-import com.cloud.agent.api.PingCommand;
-import com.cloud.agent.api.ReadyAnswer;
-import com.cloud.agent.api.ReadyCommand;
-import com.cloud.agent.api.StartupBigSwitchVnsCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.UpdateVnsPortAnswer;
-import com.cloud.agent.api.UpdateVnsPortCommand;
-import com.cloud.host.Host;
-import com.cloud.host.Host.Type;
-import com.cloud.network.bigswitch.AttachmentData;
-import com.cloud.network.bigswitch.BigSwitchVnsApi;
-import com.cloud.network.bigswitch.BigSwitchVnsApiException;
-import com.cloud.network.bigswitch.ControlClusterStatus;
-import com.cloud.network.bigswitch.NetworkData;
-import com.cloud.network.bigswitch.PortData;
-import com.cloud.resource.ServerResource;
-import com.cloud.utils.component.ManagerBase;
-
-public class BigSwitchVnsResource extends ManagerBase implements ServerResource {
-    private static final Logger s_logger = Logger.getLogger(BigSwitchVnsResource.class);
-
-    private String _name;
-    private String _guid;
-    private String _zoneId;
-    private int _numRetries;
-
-    private BigSwitchVnsApi _bigswitchVnsApi;
-
-    protected BigSwitchVnsApi createBigSwitchVnsApi() {
-        return new BigSwitchVnsApi();
-    }
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-
-        _name = (String)params.get("name");
-        if (_name == null) {
-            throw new ConfigurationException("Unable to find name");
-        }
-
-        _guid = (String)params.get("guid");
-        if (_guid == null) {
-            throw new ConfigurationException("Unable to find the guid");
-        }
-
-        _zoneId = (String)params.get("zoneId");
-        if (_zoneId == null) {
-            throw new ConfigurationException("Unable to find zone");
-        }
-
-        _numRetries = 2;
-
-        String ip = (String)params.get("ip");
-        if (ip == null) {
-            throw new ConfigurationException("Unable to find IP");
-        }
-
-        _bigswitchVnsApi = createBigSwitchVnsApi();
-        _bigswitchVnsApi.setControllerAddress(ip);
-
-        return true;
-    }
-
-    @Override
-    public boolean start() {
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-        return true;
-    }
-
-    @Override
-    public String getName() {
-        return _name;
-    }
-
-    @Override
-    public Type getType() {
-        // Think up a better name for this Type?
-        return Host.Type.L2Networking;
-    }
-
-    @Override
-    public StartupCommand[] initialize() {
-        StartupBigSwitchVnsCommand sc = new StartupBigSwitchVnsCommand();
-        sc.setGuid(_guid);
-        sc.setName(_name);
-        sc.setDataCenter(_zoneId);
-        sc.setPod("");
-        sc.setPrivateIpAddress("");
-        sc.setStorageIpAddress("");
-        sc.setVersion("");
-        return new StartupCommand[] {sc};
-    }
-
-    @Override
-    public PingCommand getCurrentStatus(long id) {
-        try {
-            ControlClusterStatus ccs = _bigswitchVnsApi.getControlClusterStatus();
-            if (!ccs.getStatus()) {
-                s_logger.error("ControlCluster state is not ready: " + ccs.getStatus());
-                return null;
-            }
-        } catch (BigSwitchVnsApiException e) {
-            s_logger.error("getControlClusterStatus failed", e);
-            return null;
-        }
-        return new PingCommand(Host.Type.L2Networking, id);
-    }
-
-    @Override
-    public Answer executeRequest(Command cmd) {
-        return executeRequest(cmd, _numRetries);
-    }
-
-    public Answer executeRequest(Command cmd, int numRetries) {
-        if (cmd instanceof ReadyCommand) {
-            return executeRequest((ReadyCommand)cmd);
-        } else if (cmd instanceof MaintainCommand) {
-            return executeRequest((MaintainCommand)cmd);
-        } else if (cmd instanceof CreateVnsNetworkCommand) {
-            return executeRequest((CreateVnsNetworkCommand)cmd, numRetries);
-        } else if (cmd instanceof DeleteVnsNetworkCommand) {
-            return executeRequest((DeleteVnsNetworkCommand)cmd, numRetries);
-        } else if (cmd instanceof CreateVnsPortCommand) {
-            return executeRequest((CreateVnsPortCommand)cmd, numRetries);
-        } else if (cmd instanceof DeleteVnsPortCommand) {
-            return executeRequest((DeleteVnsPortCommand)cmd, numRetries);
-        } else if (cmd instanceof UpdateVnsPortCommand) {
-            return executeRequest((UpdateVnsPortCommand)cmd, numRetries);
-        }
-        s_logger.debug("Received unsupported command " + cmd.toString());
-        return Answer.createUnsupportedCommandAnswer(cmd);
-    }
-
-    @Override
-    public void disconnected() {
-    }
-
-    @Override
-    public IAgentControl getAgentControl() {
-        return null;
-    }
-
-    @Override
-    public void setAgentControl(IAgentControl agentControl) {
-    }
-
-    private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) {
-        NetworkData network = new NetworkData();
-        network.getNetwork().setTenantId(cmd.getTenantUuid());
-        network.getNetwork().setUuid(cmd.getNetworkUuid());
-        network.getNetwork().setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
-        network.getNetwork().setVlan(cmd.getVlan());
-
-        try {
-            _bigswitchVnsApi.createNetwork(network);
-            return new CreateVnsNetworkAnswer(cmd, true, "VNS " + network.getNetwork().getUuid() + " created");
-        } catch (BigSwitchVnsApiException e) {
-            if (numRetries > 0) {
-                return retry(cmd, --numRetries);
-            } else {
-                return new CreateVnsNetworkAnswer(cmd, e);
-            }
-        }
-
-    }
-
-    private Answer executeRequest(DeleteVnsNetworkCommand cmd, int numRetries) {
-        try {
-            _bigswitchVnsApi.deleteNetwork(cmd.get_tenantUuid(), cmd.getNetworkUuid());
-            return new DeleteVnsNetworkAnswer(cmd, true, "VNS " + cmd.getNetworkUuid() + " deleted");
-        } catch (BigSwitchVnsApiException e) {
-            if (numRetries > 0) {
-                return retry(cmd, --numRetries);
-            } else {
-                return new DeleteVnsNetworkAnswer(cmd, e);
-            }
-        }
-    }
-
-    private Answer executeRequest(CreateVnsPortCommand cmd, int numRetries) {
-        PortData port = new PortData();
-        port.getPort().setId(cmd.getPortUuid());
-        port.getPort().setName(cmd.getPortName());
-        port.getPort().setTenantId(cmd.getTenantUuid());
-
-        try {
-            _bigswitchVnsApi.createPort(cmd.getNetworkUuid(), port);
-            try {
-                AttachmentData attachment = new AttachmentData();
-                attachment.getAttachment().setId(cmd.getPortUuid());
-                attachment.getAttachment().setMac(cmd.getMac());
-                _bigswitchVnsApi.modifyPortAttachment(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid(), attachment);
-
-            } catch (BigSwitchVnsApiException ex) {
-                s_logger.warn("modifyPortAttachment failed after switchport was created, removing switchport");
-                _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid());
-                throw (ex); // Rethrow the original exception
-            }
-            return new CreateVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " created");
-        } catch (BigSwitchVnsApiException e) {
-            if (numRetries > 0) {
-                return retry(cmd, --numRetries);
-            } else {
-                return new CreateVnsPortAnswer(cmd, e);
-            }
-        }
-    }
-
-    private Answer executeRequest(DeleteVnsPortCommand cmd, int numRetries) {
-        try {
-            _bigswitchVnsApi.deletePortAttachment(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid());
-            try {
-                _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid());
-            } catch (BigSwitchVnsApiException ex) {
-                s_logger.warn("deletePort failed after portAttachment was removed");
-                throw (ex); // Rethrow the original exception
-            }
-            return new DeleteVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " deleted");
-        } catch (BigSwitchVnsApiException e) {
-            if (numRetries > 0) {
-                return retry(cmd, --numRetries);
-            } else {
-                return new DeleteVnsPortAnswer(cmd, e);
-            }
-        }
-    }
-
-    private Answer executeRequest(UpdateVnsPortCommand cmd, int numRetries) {
-        PortData port = new PortData();
-        port.getPort().setId(cmd.getPortUuid());
-        port.getPort().setName(cmd.getPortName());
-        port.getPort().setTenantId(cmd.getTenantUuid());
-
-        try {
-            _bigswitchVnsApi.modifyPort(cmd.getNetworkUuid(), port);
-            return new UpdateVnsPortAnswer(cmd, true, "Network Port  " + cmd.getPortUuid() + " updated");
-        } catch (BigSwitchVnsApiException e) {
-            if (numRetries > 0) {
-                return retry(cmd, --numRetries);
-            } else {
-                return new UpdateVnsPortAnswer(cmd, e);
-            }
-        }
-
-    }
-
-    private Answer executeRequest(ReadyCommand cmd) {
-        return new ReadyAnswer(cmd);
-    }
-
-    private Answer executeRequest(MaintainCommand cmd) {
-        return new MaintainAnswer(cmd);
-    }
-
-    private Answer retry(Command cmd, int numRetries) {
-        s_logger.warn("Retrying " + cmd.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries);
-        return executeRequest(cmd, numRetries);
-    }
-
-    private String truncate(String string, int length) {
-        if (string.length() <= length) {
-            return string;
-        } else {
-            return string.substring(0, length);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
deleted file mode 100644
index 4d8021c..0000000
--- a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.params.HttpClientParams;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-
-public class BigSwitchApiTest {
-    BigSwitchVnsApi _api;
-    HttpClient _client = mock(HttpClient.class);
-    HttpMethod _method;
-
-    @Before
-    public void setUp() {
-        HttpClientParams hmp = mock(HttpClientParams.class);
-        when(_client.getParams()).thenReturn(hmp);
-        _api = new BigSwitchVnsApi() {
-            @Override
-            protected HttpClient createHttpClient() {
-                return _client;
-            }
-
-            @Override
-            protected HttpMethod createMethod(String type, String uri, int port) {
-                return _method;
-            }
-        };
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteUpdateObjectWithoutHostname() throws BigSwitchVnsApiException {
-        _api.setControllerAddress(null);
-        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteCreateObjectWithoutHostname() throws BigSwitchVnsApiException {
-        _api.setControllerAddress(null);
-        _api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteDeleteObjectWithoutHostname() throws BigSwitchVnsApiException {
-        _api.setControllerAddress(null);
-        _api.executeDeleteObject("/");
-    }
-
-    @Test
-    public void executeMethodTest() throws BigSwitchVnsApiException {
-        GetMethod gm = mock(GetMethod.class);
-
-        when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeMethod(gm);
-        verify(gm, times(1)).getStatusCode();
-    }
-
-    /* Bit of a roundabout way to ensure that login is called after an un authorized result
-     * It not possible to properly mock login()
-     */
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void executeMethodTestWithLogin() throws BigSwitchVnsApiException, HttpException, IOException {
-        GetMethod gm = mock(GetMethod.class);
-        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
-        when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED);
-        _api.executeMethod(gm);
-        verify(gm, times(1)).getStatusCode();
-    }
-
-    @Test
-    public void testExecuteCreateObject() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
-        verify(_method, times(1)).releaseConnection();
-
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteCreateObjectFailure() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
-        Header header = mock(Header.class);
-        when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
-        try {
-            _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteCreateObjectException() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
-        Header header = mock(Header.class);
-        when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        try {
-            _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-    @Test
-    public void testExecuteUpdateObject() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
-        verify(_method, times(1)).releaseConnection();
-        verify(_client, times(1)).executeMethod(_method);
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteUpdateObjectFailure() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
-        Header header = mock(Header.class);
-        when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
-        try {
-            _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteUpdateObjectException() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        NetworkData network = new NetworkData();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        when(_client.executeMethod((HttpMethod)any())).thenThrow(new IOException());
-        try {
-            _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-    @Test
-    public void testExecuteDeleteObject() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeDeleteObject("/");
-        verify(_method, times(1)).releaseConnection();
-        verify(_client, times(1)).executeMethod(_method);
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteDeleteObjectFailure() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
-        Header header = mock(Header.class);
-        when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
-        try {
-            _api.executeDeleteObject("/");
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-    @Test(expected = BigSwitchVnsApiException.class)
-    public void testExecuteDeleteObjectException() throws BigSwitchVnsApiException, IOException {
-        _api.setControllerAddress("10.10.0.10");
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
-        try {
-            _api.executeDeleteObject("/");
-        } finally {
-            verify(_method, times(1)).releaseConnection();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
deleted file mode 100644
index 8cf322a..0000000
--- a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
+++ /dev/null
@@ -1,271 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.resource;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.cloud.agent.api.CreateVnsNetworkAnswer;
-import com.cloud.agent.api.CreateVnsNetworkCommand;
-import com.cloud.agent.api.CreateVnsPortAnswer;
-import com.cloud.agent.api.CreateVnsPortCommand;
-import com.cloud.agent.api.DeleteVnsNetworkAnswer;
-import com.cloud.agent.api.DeleteVnsNetworkCommand;
-import com.cloud.agent.api.DeleteVnsPortAnswer;
-import com.cloud.agent.api.DeleteVnsPortCommand;
-import com.cloud.agent.api.PingCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.UpdateVnsPortAnswer;
-import com.cloud.agent.api.UpdateVnsPortCommand;
-import com.cloud.host.Host;
-import com.cloud.network.bigswitch.AttachmentData;
-import com.cloud.network.bigswitch.BigSwitchVnsApi;
-import com.cloud.network.bigswitch.BigSwitchVnsApiException;
-import com.cloud.network.bigswitch.ControlClusterStatus;
-import com.cloud.network.bigswitch.NetworkData;
-import com.cloud.network.bigswitch.PortData;
-
-public class BigSwitchVnsResourceTest {
-    BigSwitchVnsApi _bigswitchVnsApi = mock(BigSwitchVnsApi.class);
-    BigSwitchVnsResource _resource;
-    Map<String, Object> _parameters;
-
-    @Before
-    public void setUp() throws ConfigurationException {
-        _resource = new BigSwitchVnsResource() {
-            @Override
-            protected BigSwitchVnsApi createBigSwitchVnsApi() {
-                return _bigswitchVnsApi;
-            }
-        };
-
-        _parameters = new HashMap<String, Object>();
-        _parameters.put("name", "bigswitchvnstestdevice");
-        _parameters.put("ip", "127.0.0.1");
-        _parameters.put("guid", "aaaaa-bbbbb-ccccc");
-        _parameters.put("zoneId", "blublub");
-    }
-
-    @Test(expected = ConfigurationException.class)
-    public void resourceConfigureFailure() throws ConfigurationException {
-        _resource.configure("BigSwitchVnsResource", Collections.<String, Object> emptyMap());
-    }
-
-    @Test
-    public void resourceConfigure() throws ConfigurationException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        verify(_bigswitchVnsApi).setControllerAddress("127.0.0.1");
-
-        assertTrue("bigswitchvnstestdevice".equals(_resource.getName()));
-
-        /* Pretty lame test, but here to assure this plugin fails
-         * if the type name ever changes from L2Networking
-         */
-        assertTrue(_resource.getType() == Host.Type.L2Networking);
-    }
-
-    @Test
-    public void testInitialization() throws ConfigurationException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        StartupCommand[] sc = _resource.initialize();
-        assertTrue(sc.length == 1);
-        assertTrue("aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
-        assertTrue("bigswitchvnstestdevice".equals(sc[0].getName()));
-        assertTrue("blublub".equals(sc[0].getDataCenter()));
-    }
-
-    @Test
-    public void testPingCommandStatusOk() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
-        when(ccs.getStatus()).thenReturn(true);
-        when(_bigswitchVnsApi.getControlClusterStatus()).thenReturn(ccs);
-
-        PingCommand ping = _resource.getCurrentStatus(42);
-        assertTrue(ping != null);
-        assertTrue(ping.getHostId() == 42);
-        assertTrue(ping.getHostType() == Host.Type.L2Networking);
-    }
-
-    @Test
-    public void testPingCommandStatusFail() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
-        when(ccs.getStatus()).thenReturn(false);
-        when(_bigswitchVnsApi.getControlClusterStatus()).thenReturn(ccs);
-
-        PingCommand ping = _resource.getCurrentStatus(42);
-        assertTrue(ping == null);
-    }
-
-    @Test
-    public void testPingCommandStatusApiException() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
-        when(ccs.getStatus()).thenReturn(false);
-        when(_bigswitchVnsApi.getControlClusterStatus()).thenThrow(new BigSwitchVnsApiException());
-
-        PingCommand ping = _resource.getCurrentStatus(42);
-        assertTrue(ping == null);
-    }
-
-    @Test
-    public void testRetries() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        NetworkData networkdata = mock(NetworkData.class);
-        NetworkData.Network network = mock(NetworkData.Network.class);
-        when(networkdata.getNetwork()).thenReturn(network);
-        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
-
-        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
-        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer)_resource.executeRequest(cntkc);
-        assertTrue(cntka.getResult());
-    }
-
-    @Test
-    public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        NetworkData networkdata = mock(NetworkData.class);
-        NetworkData.Network network = mock(NetworkData.Network.class);
-        when(networkdata.getNetwork()).thenReturn(network);
-        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
-
-        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
-        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer)_resource.executeRequest(cntkc);
-        assertTrue(cntka.getResult());
-    }
-
-    @Test
-    public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        NetworkData networkdata = mock(NetworkData.class);
-        NetworkData.Network network = mock(NetworkData.Network.class);
-        when(networkdata.getNetwork()).thenReturn(network);
-        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createNetwork((NetworkData)any());
-
-        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
-        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer)_resource.executeRequest(cntkc);
-        assertFalse(cntka.getResult());
-    }
-
-    @Test
-    public void testDeleteNetwork() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        DeleteVnsNetworkCommand dntkc = new DeleteVnsNetworkCommand("tenantid", "networkid");
-        DeleteVnsNetworkAnswer dntka = (DeleteVnsNetworkAnswer)_resource.executeRequest(dntkc);
-        assertTrue(dntka.getResult());
-    }
-
-    @Test
-    public void testDeleteNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).deleteNetwork((String)any(), (String)any());
-
-        DeleteVnsNetworkCommand dntkc = new DeleteVnsNetworkCommand("tenantid", "networkid");
-        DeleteVnsNetworkAnswer dntka = (DeleteVnsNetworkAnswer)_resource.executeRequest(dntkc);
-        assertFalse(dntka.getResult());
-    }
-
-    @Test
-    public void testCreatePort() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        PortData portdata = mock(PortData.class);
-        PortData.Port port = mock(PortData.Port.class);
-        when(portdata.getPort()).thenReturn(port);
-        when(port.getId()).thenReturn("eeee");
-
-        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
-        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
-        assertTrue(cntka.getResult());
-    }
-
-    @Test
-    public void testCreatePortApiExceptionInCreate() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        PortData portdata = mock(PortData.class);
-        PortData.Port port = mock(PortData.Port.class);
-        when(portdata.getPort()).thenReturn(port);
-        when(port.getId()).thenReturn("eeee");
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (PortData)any());
-
-        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
-        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
-        assertFalse(cntka.getResult());
-    }
-
-    @Test
-    public void testCreatePortApiExceptionInModify() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        PortData portdata = mock(PortData.class);
-        PortData.Port port = mock(PortData.Port.class);
-        when(portdata.getPort()).thenReturn(port);
-        when(port.getId()).thenReturn("eeee");
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (AttachmentData)any());
-
-        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
-        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
-        assertFalse(cntka.getResult());
-        verify(_bigswitchVnsApi, atLeastOnce()).deletePort((String)any(), (String)any(), (String)any());
-    }
-
-    @Test
-    public void testDeletePortException() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).deletePort((String)any(), (String)any(), (String)any());
-        DeleteVnsPortAnswer dntkpa = (DeleteVnsPortAnswer)_resource.executeRequest(new DeleteVnsPortCommand("networkId", "portid", "tenantid"));
-        assertFalse(dntkpa.getResult());
-    }
-
-    @Test
-    public void testUpdatePortException() throws ConfigurationException, BigSwitchVnsApiException {
-        _resource.configure("BigSwitchVnsResource", _parameters);
-
-        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPort((String)any(), (PortData)any());
-        UpdateVnsPortAnswer dntkpa = (UpdateVnsPortAnswer)_resource.executeRequest(new UpdateVnsPortCommand("networkId", "portId", "tenantId", "portname"));
-        assertFalse(dntkpa.getResult());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/findbugsExcludeFilter.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/findbugsExcludeFilter.xml b/plugins/network-elements/bigswitch/findbugsExcludeFilter.xml
new file mode 100644
index 0000000..d372850
--- /dev/null
+++ b/plugins/network-elements/bigswitch/findbugsExcludeFilter.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<FindBugsFilter>
+
+
+</FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/pom.xml b/plugins/network-elements/bigswitch/pom.xml
new file mode 100644
index 0000000..d530088
--- /dev/null
+++ b/plugins/network-elements/bigswitch/pom.xml
@@ -0,0 +1,52 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-plugin-network-bigswitch</artifactId>
+  <name>Apache CloudStack Plugin - BigSwitch Virtual Network Segment</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.6.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>com.mycila</groupId>
+        <artifactId>license-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>cloudstack-checklicence</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/module.properties
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/module.properties b/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/module.properties
new file mode 100644
index 0000000..22bc7d8
--- /dev/null
+++ b/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/module.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name=bigswitch
+parent=network

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/spring-bigswitch-context.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/spring-bigswitch-context.xml b/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/spring-bigswitch-context.xml
new file mode 100644
index 0000000..ea3d3aa
--- /dev/null
+++ b/plugins/network-elements/bigswitch/resources/META-INF/cloudstack/bigswitch/spring-bigswitch-context.xml
@@ -0,0 +1,41 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="bigSwitchBcfDaoImpl" class="com.cloud.network.dao.BigSwitchBcfDaoImpl" />
+    <bean id="BigSwitchBcfGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchBcfGuestNetworkGuru">
+        <property name="name" value="BigSwitchBcfGuestNetworkGuru" />
+    </bean>
+    <bean id="BigSwitchBcf" class="com.cloud.network.element.BigSwitchBcfElement">
+        <property name="name" value="BigSwitchBcf" />
+    </bean>
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
new file mode 100644
index 0000000..d144386
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
@@ -0,0 +1,43 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class BcfAnswer extends Answer{
+    private final String hash;
+
+    public BcfAnswer(Command command, boolean success, String details) {
+        super(command, success, details);
+        this.hash = "";
+    }
+
+    public BcfAnswer(Command command, boolean success, String details, String hash) {
+        super(command, success, details);
+        this.hash = hash;
+    }
+
+    public BcfAnswer(Command command, Exception e) {
+        super(command, e);
+        this.hash = "";
+    }
+
+    public String getHash() {
+        return hash;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
new file mode 100644
index 0000000..b245945
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
@@ -0,0 +1,48 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import com.cloud.network.bigswitch.TopologyData;
+
+public class BcfCommand extends Command {
+    private TopologyData topology = null;
+    private boolean _topologySyncRequested = false;
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public TopologyData getTopology() {
+        return topology;
+    }
+
+    public void setTopology(TopologyData topology) {
+        this.topology = topology;
+    }
+
+    public boolean is_topologySyncRequested() {
+        return _topologySyncRequested;
+    }
+
+    public void set_topologySyncRequested(boolean requested) {
+        this._topologySyncRequested = requested;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
new file mode 100644
index 0000000..39e7b66
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
@@ -0,0 +1,39 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import com.cloud.network.bigswitch.TopologyData;
+
+public class CacheBcfTopologyCommand extends Command{
+    private final TopologyData topology;
+
+    public CacheBcfTopologyCommand(TopologyData topology){
+        this.topology = topology;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public TopologyData getTopology() {
+        return topology;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
new file mode 100644
index 0000000..97d56a5
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
@@ -0,0 +1,75 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class CreateBcfAttachmentCommand extends BcfCommand {
+    private String _tenantId;
+    private String _tenantName;
+    private String _networkId;
+    private String _portId;
+    private String _nicId;
+    private Integer _vlan;
+    private String _ipv4;
+    private String _mac;
+
+    public CreateBcfAttachmentCommand(String tenantId, String tenantName,
+            String networkId, String portId, String nicId,
+            Integer vlan, String ipv4, String mac) {
+        this._tenantId = tenantId;
+        this._tenantName = tenantName;
+        this._networkId = networkId;
+        this._portId = portId;
+        this._nicId = nicId;
+        this._vlan = vlan;
+        this._ipv4 = ipv4;
+        this._mac = mac;
+    }
+
+    public String getTenantId() {
+        return _tenantId;
+    }
+
+    public String getTenantName() {
+        return _tenantName;
+    }
+    public String getNetworkId() {
+        return _networkId;
+    }
+
+    public String getPortId() {
+        return _portId;
+    }
+
+    public String getNicId() {
+        return _nicId;
+    }
+
+    public Integer getVlan() {
+        return _vlan;
+    }
+
+    public String getIpv4() {
+        return _ipv4;
+    }
+
+    public String getMac() {
+        return _mac;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
new file mode 100644
index 0000000..4379ed4
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
@@ -0,0 +1,32 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class CreateBcfRouterCommand extends BcfCommand {
+    private final String _tenantId;
+
+    public CreateBcfRouterCommand(String tenantId){
+        this._tenantId = tenantId;
+    }
+
+    public String get_tenantId() {
+        return _tenantId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
new file mode 100644
index 0000000..4b8d227
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
@@ -0,0 +1,57 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class CreateBcfRouterInterfaceCommand extends BcfCommand{
+    private final String _tenantId;
+    private final String _networkId;
+    private final String _cidr;
+    private final String _gateway;
+    private final String _networkName;
+
+    public CreateBcfRouterInterfaceCommand(String tenantId, String networkId, String cidr,
+            String gateway, String networkName){
+        this._tenantId = tenantId;
+        this._networkId = networkId;
+        this._networkName = networkName;
+        this._cidr = cidr;
+        this._gateway = gateway;
+    }
+
+    public String get_tenantId() {
+        return _tenantId;
+    }
+
+    public String get_networkId() {
+        return _networkId;
+    }
+
+    public String get_networkName() {
+        return _networkName;
+    }
+
+    public String get_cidr() {
+        return _cidr;
+    }
+
+    public String get_gateway() {
+        return _gateway;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
new file mode 100644
index 0000000..d54dac6
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
@@ -0,0 +1,57 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class CreateBcfSegmentCommand extends BcfCommand {
+    private String _tenantId;
+    private String _tenantName;
+    private String _networkId;
+    private String _networkName;
+    private Integer _vlan;
+
+    public CreateBcfSegmentCommand(String tenantId, String tenantName,
+            String networkId, String networkName, Integer vlan) {
+        this._tenantId = tenantId;
+        this._tenantName = tenantName;
+        this._networkId = networkId;
+        this._networkName = networkName;
+        this._vlan = vlan;
+    }
+
+    public String getNetworkId() {
+        return _networkId;
+    }
+
+    public String getNetworkName() {
+        return _networkName;
+    }
+
+    public String getTenantId() {
+        return _tenantId;
+    }
+
+    public String getTenantName() {
+        return _tenantName;
+    }
+
+    public Integer getVlan() {
+        return _vlan;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
new file mode 100644
index 0000000..917f480
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
@@ -0,0 +1,57 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class CreateBcfStaticNatCommand extends BcfCommand {
+    private final String _tenantId;
+    private final String _networkId;
+    private final String _privateIp;
+    private final String _publicIp;
+    private final String _mac;
+
+    public CreateBcfStaticNatCommand(String tenantId, String networkId,
+            String privateIp, String publicIp, String mac){
+        this._tenantId = tenantId;
+        this._networkId = networkId;
+        this._privateIp = privateIp;
+        this._publicIp = publicIp;
+        this._mac = mac;
+    }
+
+    public String get_tenantId() {
+        return _tenantId;
+    }
+
+    public String get_networkId() {
+        return _networkId;
+    }
+
+    public String get_privateIp() {
+        return _privateIp;
+    }
+
+    public String get_publicIp() {
+        return _publicIp;
+    }
+
+    public String get_mac() {
+        return _mac;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
new file mode 100644
index 0000000..d5cf13f
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
@@ -0,0 +1,45 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class DeleteBcfAttachmentCommand extends BcfCommand {
+    private String _tenantId;
+    private String _networkId;
+    private String _attachmentId;
+
+    public DeleteBcfAttachmentCommand(String tenantId,
+            String networkId, String attachmentId) {
+        this._tenantId = tenantId;
+        this._networkId = networkId;
+        this._attachmentId = attachmentId;
+    }
+
+    public String getTenantId() {
+        return _tenantId;
+    }
+
+    public String getNetworkId() {
+        return _networkId;
+    }
+
+    public String getAttachmentId() {
+        return _attachmentId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
new file mode 100644
index 0000000..a6987a5
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
@@ -0,0 +1,39 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class DeleteBcfSegmentCommand extends BcfCommand {
+
+    private String _tenantUuid;
+    private String _networkUuid;
+
+    public DeleteBcfSegmentCommand(String tenantUuid, String networkUuid) {
+        this._tenantUuid = tenantUuid;
+        this._networkUuid = networkUuid;
+    }
+
+    public String get_tenantUuid() {
+        return _tenantUuid;
+    }
+
+    public String getNetworkUuid() {
+        return _networkUuid;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
new file mode 100644
index 0000000..7861bfb
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
@@ -0,0 +1,44 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class DeleteBcfStaticNatCommand extends BcfCommand {
+    private final String _tenantId;
+    private final String _publicIp;
+    private final String _floatingIpId;
+
+    public DeleteBcfStaticNatCommand(String tenantId, String publicIp){
+        this._tenantId = tenantId;
+        this._publicIp = publicIp;
+        this._floatingIpId = publicIp.replace(".", "-");
+    }
+
+    public String get_tenantId() {
+        return _tenantId;
+    }
+
+    public String get_publicIp() {
+        return _publicIp;
+    }
+
+    public String get_floatingIpId() {
+        return _floatingIpId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
new file mode 100644
index 0000000..e32bfb0
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
@@ -0,0 +1,45 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class GetControllerDataAnswer extends Answer {
+    private final String ipAddress;
+    private final boolean isMaster;
+
+    public GetControllerDataAnswer(GetControllerDataCommand cmd,
+            String ipAddress, boolean isMaster){
+        this.ipAddress = ipAddress;
+        this.isMaster = isMaster;
+    }
+
+    public GetControllerDataAnswer(Command command, Exception e) {
+        super(command, e);
+        this.ipAddress = null;
+        this.isMaster = false;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public boolean isMaster() {
+        return isMaster;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
new file mode 100644
index 0000000..661ad16
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
@@ -0,0 +1,25 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class GetControllerDataCommand extends BcfCommand {
+    public GetControllerDataCommand() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
new file mode 100644
index 0000000..413e83e
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
@@ -0,0 +1,40 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import com.cloud.host.HostVO;
+
+public class GetControllerHostsAnswer {
+    private HostVO master;
+    private HostVO slave;
+
+    public HostVO getMaster() {
+        return master;
+    }
+    public void setMaster(HostVO master) {
+        this.master = master;
+    }
+    public HostVO getSlave() {
+        return slave;
+    }
+    public void setSlave(HostVO slave) {
+        this.slave = slave;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
new file mode 100644
index 0000000..253c8e2
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
@@ -0,0 +1,25 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class GetControllerHostsCommand extends BcfCommand {
+    public GetControllerHostsCommand() {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/StartupBigSwitchBcfCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/StartupBigSwitchBcfCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/StartupBigSwitchBcfCommand.java
new file mode 100644
index 0000000..6acb43d
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/StartupBigSwitchBcfCommand.java
@@ -0,0 +1,30 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupBigSwitchBcfCommand extends StartupCommand {
+
+    public StartupBigSwitchBcfCommand() {
+        super(Host.Type.L2Networking);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
new file mode 100644
index 0000000..660151c
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
@@ -0,0 +1,38 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class SyncBcfTopologyCommand extends BcfCommand {
+    private final boolean networkIncluded;
+    private final boolean routerIncluded;
+
+    public SyncBcfTopologyCommand(boolean networkIncluded, boolean routerIncluded) {
+        this.networkIncluded = networkIncluded;
+        this.routerIncluded = routerIncluded;
+    }
+
+    public boolean isNetworkIncluded() {
+        return networkIncluded;
+    }
+
+    public boolean isRouterIncluded() {
+        return routerIncluded;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
new file mode 100644
index 0000000..412ee21
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+public class UpdateBcfAttachmentCommand extends BcfCommand {
+    private String _networkId;
+    private String _attachmentId;
+    private String _tenantId;
+    private String _attachmentName;
+
+    public UpdateBcfAttachmentCommand(String networkId, String attachmentId, String tenantId, String attachmentName) {
+        this._networkId = networkId;
+        this._attachmentId = attachmentId;
+        this._tenantId = tenantId;
+        this._attachmentName = attachmentName;
+    }
+
+    public String getNetworkId() {
+        return _networkId;
+    }
+
+    public String getAttachmentId() {
+        return _attachmentId;
+    }
+
+    public String getTenantId() {
+        return _tenantId;
+    }
+
+    public String getPortName() {
+        return _attachmentName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
new file mode 100644
index 0000000..675a1ee
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
@@ -0,0 +1,61 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.network.bigswitch.AclData;
+
+public class UpdateBcfRouterCommand extends BcfCommand {
+    private String tenantId;
+    private String publicIp;
+    private List<AclData> acls;
+
+    public UpdateBcfRouterCommand(String tenantId){
+        this.tenantId = tenantId;
+        this.publicIp = null;
+        this.acls = new ArrayList<AclData>();
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getPublicIp() {
+        return publicIp;
+    }
+
+    public void setPublicIp(String publicIp) {
+        this.publicIp = publicIp;
+    }
+
+    public List<AclData> getAcls() {
+        return acls;
+    }
+
+    public void addAcl(AclData acl){
+        this.acls.add(acl);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
new file mode 100644
index 0000000..24334ea
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
@@ -0,0 +1,143 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.api.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.api.response.BigSwitchBcfDeviceResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.network.element.BigSwitchBcfElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "addBigSwitchBcfDevice", responseObject = BigSwitchBcfDeviceResponse.class, description = "Adds a BigSwitch BCF Controller device", since = "4.6.0",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
+    private static final String s_name = "addbigswitchbcfdeviceresponse";
+    @Inject
+    BigSwitchBcfElementService _bigswitchBcfElementService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = PhysicalNetworkResponse.class,
+               required = true,
+               description = "the Physical Network ID")
+    private Long physicalNetworkId;
+
+    @Parameter(name = ApiConstants.HOST_NAME, type = CommandType.STRING, required = true, description = "Hostname of ip address of the BigSwitch BCF Controller.")
+    private String host;
+
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true,
+            description="Username of the BigSwitch BCF Controller.")
+    private String username;
+
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true,
+            description="Password of the BigSwitch BCF Controller.")
+    private String password;
+
+    @Parameter(name=BcfConstants.BIGSWITCH_BCF_DEVICE_NAT, type=CommandType.BOOLEAN, required=true,
+            description="NAT support of the BigSwitch BCF Controller.")
+    private Boolean nat;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public Boolean getNat() {
+        return nat;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+        ResourceAllocationException {
+        try {
+            BigSwitchBcfDeviceVO bigswitchBcfDeviceVO = _bigswitchBcfElementService.addBigSwitchBcfDevice(this);
+            if (bigswitchBcfDeviceVO != null) {
+                BigSwitchBcfDeviceResponse response = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchBcfDeviceVO);
+                response.setObjectName("bigswitchbcfdevice");
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add BigSwitch BCF Controller device due to internal error.");
+            }
+        } catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return CallContext.current().getCallingAccount().getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_ADD;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Adding a BigSwitch BCF Controller";
+    }
+}


[38/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8375: VCenter port group verification - return as PASS if no physical networks in zone

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8a5b1e60
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8a5b1e60
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8a5b1e60

Branch: refs/heads/reporter
Commit: 8a5b1e60a4fc75ad57b9b127d1c6f13c202415c4
Parents: 4d05c3b
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Sat Apr 11 15:35:51 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Apr 13 16:58:14 2015 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/lib/common.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8a5b1e60/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index d1dd856..ca9d9e8 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1688,8 +1688,11 @@ def verifyVCenterPortGroups(
                 api_client,
                 zoneid=zoneid
             )
-        assert validateList(physicalNetworks)[0] == PASS,\
-                "listPhysicalNetworks returned invalid object in response."
+
+        # If there are no physical networks in zone, return as PASS
+        # as there are no validations to make
+        if validateList(physicalNetworks)[0] != PASS:
+            return [PASS, None]
 
         for physicalNetwork in physicalNetworks:
             trafficTypes = TrafficType.list(


[24/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
empty comments needed for license?

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/951ffb1f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/951ffb1f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/951ffb1f

Branch: refs/heads/reporter
Commit: 951ffb1f0383f4301abdd97db3738307a8dfee8e
Parents: 21e18b1
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Mon Apr 13 02:07:56 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Mon Apr 13 02:07:56 2015 +0200

----------------------------------------------------------------------
 .../test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/951ffb1f/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
index 97dd268..7bf5b12 100644
--- a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
@@ -1,3 +1,4 @@
+//
 // Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
 // distributed with this work for additional information
@@ -14,6 +15,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+//
 package com.cloud.network.bigswitch;
 
 import static org.junit.Assert.assertEquals;


[07/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-6697: bigswitch networking plugin update

1. provide compatibility with the Big Cloud Fabric (BCF) controller
   L2 Connectivity Service in both VPC and non-VPC modes
2. virtual network terminology updates: VNS --> BCF_SEGMENT
3. uses HTTPS with trust-always certificate handling
4. topology sync support with BCF controller
5. support multiple (two) BCF controllers with HA
6. support VM migration
7. support Firewall, Static NAT, and Source NAT with NAT enabled option
8. add VifDriver for Indigo Virtual Switch (IVS)

This closes #151

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/01864ef7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/01864ef7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/01864ef7

Branch: refs/heads/reporter
Commit: 01864ef77c8271478135caf5c00e11b441dc5c82
Parents: 7243024
Author: KC Wang <ku...@gmail.com>
Authored: Fri Sep 26 14:09:30 2014 -0700
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Apr 9 13:02:02 2015 +0530

----------------------------------------------------------------------
 api/src/com/cloud/network/Network.java          |   2 +
 api/src/com/cloud/network/PhysicalNetwork.java  |   2 +-
 api/src/com/cloud/network/rules/StaticNat.java  |   2 +
 .../classes/resources/messages.properties       |  12 +-
 .../classes/resources/messages_fr_FR.properties |  10 +-
 .../classes/resources/messages_ja_JP.properties |   8 +-
 .../classes/resources/messages_ko_KR.properties |   2 +-
 .../classes/resources/messages_nl_NL.properties |  10 +-
 .../classes/resources/messages_pt_BR.properties |   6 +-
 .../classes/resources/messages_ru_RU.properties |   4 +-
 .../classes/resources/messages_zh_CN.properties |   8 +-
 client/pom.xml                                  |   2 +-
 client/tomcatconf/commands.properties.in        |   8 +-
 .../cloud/user/dao/VmDiskStatisticsDaoImpl.java |   4 +-
 framework/rest/.gitignore                       |   1 +
 .../hypervisor/kvm/resource/IvsVifDriver.java   | 286 +++++++
 plugins/network-elements/bigswitch-vns/pom.xml  |  29 -
 .../META-INF/cloudstack/vns/module.properties   |  18 -
 .../cloudstack/vns/spring-vns-context.xml       |  36 -
 .../cloud/agent/api/CreateVnsNetworkAnswer.java |  28 -
 .../agent/api/CreateVnsNetworkCommand.java      |  52 --
 .../cloud/agent/api/CreateVnsPortAnswer.java    |  29 -
 .../cloud/agent/api/CreateVnsPortCommand.java   |  59 --
 .../cloud/agent/api/DeleteVnsNetworkAnswer.java |  29 -
 .../agent/api/DeleteVnsNetworkCommand.java      |  41 -
 .../cloud/agent/api/DeleteVnsPortAnswer.java    |  29 -
 .../cloud/agent/api/DeleteVnsPortCommand.java   |  48 --
 .../agent/api/StartupBigSwitchVnsCommand.java   |  27 -
 .../cloud/agent/api/UpdateVnsPortAnswer.java    |  29 -
 .../cloud/agent/api/UpdateVnsPortCommand.java   |  53 --
 .../api/commands/AddBigSwitchVnsDeviceCmd.java  | 116 ---
 .../commands/DeleteBigSwitchVnsDeviceCmd.java   | 107 ---
 .../commands/ListBigSwitchVnsDevicesCmd.java    | 111 ---
 .../com/cloud/api/commands/VnsConstants.java    |  35 -
 .../response/BigSwitchVnsDeviceResponse.java    |  74 --
 .../com/cloud/network/BigSwitchVnsDeviceVO.java |  96 ---
 .../cloud/network/bigswitch/AttachmentData.java |  50 --
 .../network/bigswitch/BigSwitchVnsApi.java      | 315 --------
 .../bigswitch/BigSwitchVnsApiException.java     |  38 -
 .../network/bigswitch/ControlClusterStatus.java |  29 -
 .../cloud/network/bigswitch/NetworkData.java    |  86 --
 .../com/cloud/network/bigswitch/PortData.java   |  68 --
 .../com/cloud/network/dao/BigSwitchVnsDao.java  |  32 -
 .../cloud/network/dao/BigSwitchVnsDaoImpl.java  |  50 --
 .../network/element/BigSwitchVnsElement.java    | 472 -----------
 .../element/BigSwitchVnsElementService.java     |  38 -
 .../guru/BigSwitchVnsGuestNetworkGuru.java      | 240 ------
 .../network/resource/BigSwitchVnsResource.java  | 309 --------
 .../network/bigswitch/BigSwitchApiTest.java     | 232 ------
 .../resource/BigSwitchVnsResourceTest.java      | 271 -------
 .../bigswitch/findbugsExcludeFilter.xml         |  25 +
 plugins/network-elements/bigswitch/pom.xml      |  52 ++
 .../cloudstack/bigswitch/module.properties      |  21 +
 .../bigswitch/spring-bigswitch-context.xml      |  41 +
 .../src/com/cloud/agent/api/BcfAnswer.java      |  43 +
 .../src/com/cloud/agent/api/BcfCommand.java     |  48 ++
 .../agent/api/CacheBcfTopologyCommand.java      |  39 +
 .../agent/api/CreateBcfAttachmentCommand.java   |  75 ++
 .../cloud/agent/api/CreateBcfRouterCommand.java |  32 +
 .../api/CreateBcfRouterInterfaceCommand.java    |  57 ++
 .../agent/api/CreateBcfSegmentCommand.java      |  57 ++
 .../agent/api/CreateBcfStaticNatCommand.java    |  57 ++
 .../agent/api/DeleteBcfAttachmentCommand.java   |  45 ++
 .../agent/api/DeleteBcfSegmentCommand.java      |  39 +
 .../agent/api/DeleteBcfStaticNatCommand.java    |  44 ++
 .../agent/api/GetControllerDataAnswer.java      |  45 ++
 .../agent/api/GetControllerDataCommand.java     |  25 +
 .../agent/api/GetControllerHostsAnswer.java     |  40 +
 .../agent/api/GetControllerHostsCommand.java    |  25 +
 .../agent/api/StartupBigSwitchBcfCommand.java   |  30 +
 .../cloud/agent/api/SyncBcfTopologyCommand.java |  38 +
 .../agent/api/UpdateBcfAttachmentCommand.java   |  50 ++
 .../cloud/agent/api/UpdateBcfRouterCommand.java |  61 ++
 .../api/commands/AddBigSwitchBcfDeviceCmd.java  | 143 ++++
 .../com/cloud/api/commands/BcfConstants.java    |  37 +
 .../commands/DeleteBigSwitchBcfDeviceCmd.java   | 110 +++
 .../commands/ListBigSwitchBcfDevicesCmd.java    | 114 +++
 .../response/BigSwitchBcfDeviceResponse.java    |  99 +++
 .../com/cloud/network/BigSwitchBcfDeviceVO.java | 143 ++++
 .../com/cloud/network/bigswitch/AclData.java    | 114 +++
 .../cloud/network/bigswitch/AttachmentData.java | 142 ++++
 .../network/bigswitch/BigSwitchBcfApi.java      | 459 +++++++++++
 .../bigswitch/BigSwitchBcfApiException.java     |  55 ++
 .../network/bigswitch/BigSwitchBcfUtils.java    | 571 ++++++++++++++
 .../network/bigswitch/BigSwitchStatus.java      |  32 +
 .../cloud/network/bigswitch/Capabilities.java   |  34 +
 .../network/bigswitch/ControlClusterData.java   |  43 +
 .../network/bigswitch/ControlClusterStatus.java |  32 +
 .../cloud/network/bigswitch/ControllerData.java |  39 +
 .../cloud/network/bigswitch/FloatingIpData.java |  93 +++
 .../cloud/network/bigswitch/NetworkData.java    | 217 +++++
 .../com/cloud/network/bigswitch/RouterData.java | 131 ++++
 .../network/bigswitch/RouterInterfaceData.java  |  67 ++
 .../cloud/network/bigswitch/TopologyData.java   | 249 ++++++
 .../TrustingProtocolSocketFactory.java          | 114 +++
 .../com/cloud/network/dao/BigSwitchBcfDao.java  |  35 +
 .../cloud/network/dao/BigSwitchBcfDaoImpl.java  |  53 ++
 .../network/element/BigSwitchBcfElement.java    | 785 +++++++++++++++++++
 .../element/BigSwitchBcfElementService.java     |  41 +
 .../guru/BigSwitchBcfGuestNetworkGuru.java      | 423 ++++++++++
 .../network/resource/BigSwitchBcfResource.java  | 589 ++++++++++++++
 .../network/bigswitch/BigSwitchApiTest.java     | 433 ++++++++++
 .../resource/BigSwitchBcfResourceTest.java      | 431 ++++++++++
 plugins/pom.xml                                 |   2 +-
 scripts/util/qemu-ivs-ifup                      |  20 +
 server/src/com/cloud/api/ApiResponseHelper.java |   2 +-
 .../cloud/network/rules/RulesManagerImpl.java   |   9 +-
 .../com/cloud/network/rules/StaticNatImpl.java  |  18 +
 .../com/cloud/network/vpc/VpcManagerImpl.java   |   4 +-
 setup/db/create-schema.sql                      |   1 +
 setup/db/db/schema-442to450.sql                 |  18 +
 .../integration/component/test_bigswitch_bcf.py | 776 ++++++++++++++++++
 tools/apidoc/gen_toc.py                         |   2 +-
 tools/eclipse/eclipse.epf                       |  14 +-
 ui/dictionary.jsp                               |   4 +-
 ui/dictionary2.jsp                              |   6 +-
 ui/scripts/configuration.js                     |  18 +-
 ui/scripts/system.js                            | 154 ++--
 ui/scripts/ui-custom/zoneWizard.js              |   4 +-
 119 files changed, 8117 insertions(+), 3395 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index e07cea6..d39489e 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -138,6 +138,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
         public static final Provider BrocadeVcs = new Provider("BrocadeVcs", false);
         // add GloboDns provider
         public static final Provider GloboDns = new Provider("GloboDns", true);
+        // add Big Switch Bcf Provider
+        public static final Provider BigSwitchBcf = new Provider("BigSwitchBcf", false);
 
         private final String name;
         private final boolean isExternal;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/api/src/com/cloud/network/PhysicalNetwork.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index 7c9349d..bdf098f 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -33,7 +33,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
     }
 
     public enum IsolationMethod {
-        VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN, ODL, L3VPN, VSP, VCS;
+        VLAN, L3, GRE, STT, BCF_SEGMENT, MIDO, SSP, VXLAN, ODL, L3VPN, VSP, VCS;
     }
 
     public enum BroadcastDomainRange {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/api/src/com/cloud/network/rules/StaticNat.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/StaticNat.java b/api/src/com/cloud/network/rules/StaticNat.java
index 977bc28..2c33b37 100644
--- a/api/src/com/cloud/network/rules/StaticNat.java
+++ b/api/src/com/cloud/network/rules/StaticNat.java
@@ -28,5 +28,7 @@ public interface StaticNat {
 
     String getDestIpAddress();
 
+    String getSourceMacAddress();
+
     boolean isForRevoke();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index ca67d68..65e9362 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -302,7 +302,7 @@ label.add.accounts.to=Add accounts to
 label.add.accounts=Add accounts
 label.add.ACL=Add ACL
 label.add.affinity.group=Add new affinity group
-label.add.BigSwitchVns.device=Add BigSwitch Vns Controller
+label.add.BigSwitchBcf.device=Add BigSwitch BCF Controller
 label.add.by.cidr=Add By CIDR
 label.add.by.group=Add By Group
 label.add.by=Add by
@@ -415,7 +415,7 @@ label.back=Back
 label.bandwidth=Bandwidth
 label.basic.mode=Basic Mode
 label.basic=Basic
-label.bigswitch.controller.address=BigSwitch Vns Controller Address
+label.bigswitch.controller.address=BigSwitch BCF Controller Address
 label.bootable=Bootable
 label.broadcast.domain.range=Broadcast domain range
 label.broadcast.domain.type=Broadcast Domain Type
@@ -509,7 +509,7 @@ label.default.use=Default Use
 label.default.view=Default View
 label.default=Default
 label.delete.affinity.group=Delete Affinity Group
-label.delete.BigSwitchVns=Remove BigSwitch Vns Controller
+label.delete.BigSwitchBcf=Remove BigSwitch BCF Controller
 label.delete.F5=Delete F5
 label.delete.gateway=Delete gateway
 label.delete.NetScaler=Delete NetScaler
@@ -1450,8 +1450,9 @@ label.added.nicira.nvp.controller=Added new Nicira NVP Controller
 label.nicira.nvp.details=Nicira NVP details
 label.added.brocade.vcs.switch=Added new Brocade Vcs Switch
 label.brocade.vcs.details=Brocade Vcs Switch details
-label.added.new.bigswitch.vns.controller=Added new BigSwitch VNS Controller
-label.bigswitch.vns.details=BigSwitch VNS details
+label.added.new.bigswitch.bcf.controller=Added new BigSwitch BCF Controller
+label.bigswitch.bcf.details=BigSwitch BCF details
+label.bigswitch.bcf.nat=BigSwitch BCF NAT Enabled
 label.dedicate=Dedicate
 label.dedicate.pod=Dedicate Pod
 label.pod.dedicated=Pod Dedicated
@@ -1733,6 +1734,7 @@ message.configuring.public.traffic=Configuring public traffic
 message.configuring.storage.traffic=Configuring storage traffic
 message.confirm.action.force.reconnect=Please confirm that you want to force reconnect this host.
 message.confirm.delete.F5=Please confirm that you would like to delete F5
+message.confirm.delete.BigSwitchBcf=Please confirm that you would like to delete this BigSwitch BCF Controller
 message.confirm.delete.BrocadeVcs=Please confirm that you would like to delete Brocade Vcs Switch
 message.confirm.delete.NetScaler=Please confirm that you would like to delete NetScaler
 message.confirm.delete.NuageVsp=Please confirm that you would like to delete Nuage Virtualized Services Directory

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index c24fce3..8a3939a 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -257,8 +257,8 @@ label.add.acl.list=Ajouter Liste ACL
 label.add.affinity.group=Ajouter nouveau groupe d\\'affinit\u00e9
 label.add=Ajouter
 label.add.baremetal.dhcp.device=Ajouter un DHCP Baremetal
-label.add.BigSwitchVns.device=Ajouter contr\u00f4leur BigSwitch Vns
 label.add.BrocadeVcs.device=Ajouter Switch Brocade Vcs
+label.add.BigSwitchBcf.device=Ajouter contr\u00f4leur BigSwitch BCF
 label.add.by=Ajout\u00e9 par
 label.add.by.cidr=Ajouter par CIDR
 label.add.by.group=Ajouter par groupe
@@ -269,7 +269,7 @@ label.add.direct.iprange=Ajouter une plage d\\'adresse IP directe
 label.add.disk.offering=Ajouter Offre Disque
 label.add.domain=Ajouter un domaine
 label.added.brocade.vcs.switch=Ajout d\\'un nouveau switch Brocade Vcs
-label.added.new.bigswitch.vns.controller=Ajout du nouveau contr\u00f4leur BigSwitch VNS
+label.added.new.bigswitch.bcf.controller=Ajout du nouveau contr\u00f4leur BigSwitch BCF
 label.added.nicira.nvp.controller=Ajout d\\'un nouveau contr\u00f4leur Nicira NVP
 label.add.egress.rule=Ajouter la r\u00e8gle sortante
 label.addes.new.f5=Ajout d\\'un nouveau F5
@@ -403,8 +403,8 @@ label.baremetal.pxe.devices=\u00c9quipements PXE Baremetal
 label.baremetal.pxe.provider=Fournisseur PXE Baremetal
 label.basic=Basique
 label.basic.mode=Mode basique
-label.bigswitch.controller.address=Adresse du contr\u00f4leur BigSwitch Vns
-label.bigswitch.vns.details=D\u00e9tails BigSwitch VNS
+label.bigswitch.controller.address=Adresse du contr\u00f4leur BigSwitch BCF
+label.bigswitch.bcf.details=D\u00e9tails BigSwitch BCF
 label.blade.id=ID Lame
 label.blades=Lames
 label.bootable=Amor\u00e7able
@@ -527,9 +527,9 @@ label.default.view=Vue par d\u00e9faut
 label.delete.acl.list=Supprimer Liste ACL
 label.delete.affinity.group=Supprimer le groupe d\\'affinit\u00e9
 label.delete.alerts=Supprimer alertes
-label.delete.BigSwitchVns=Supprimer contr\u00f4leur BigSwitch Vns
 label.delete.BrocadeVcs=Supprimer Brocade Vcs Switch
 label.delete.ciscoASA1000v=Supprimer CiscoASA1000v
+label.delete.BigSwitchBcf=Supprimer contr\u00f4leur BigSwitch BCF
 label.delete.ciscovnmc.resource=Supprimer ressource CiscoVNMC
 label.delete.events=Supprimer \u00e9v\u00e9nements
 label.delete.F5=Supprimer F5

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_ja_JP.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties
index 7d6c6ae..bee5d10 100644
--- a/client/WEB-INF/classes/resources/messages_ja_JP.properties
+++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties
@@ -300,7 +300,7 @@ label.add.accounts.to=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u8ffd\u52a0\u5148\:
 label.add.accounts=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u8ffd\u52a0
 label.add.ACL=ACL \u306e\u8ffd\u52a0
 label.add.affinity.group=\u65b0\u3057\u3044\u30a2\u30d5\u30a3\u30cb\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7\u306e\u8ffd\u52a0
-label.add.BigSwitchVns.device=Big Switch VNS \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u8ffd\u52a0
+label.add.BigSwitchBcf.device=Big Switch BCF \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u8ffd\u52a0
 label.add.by.cidr=CIDR \u3067\u8ffd\u52a0
 label.add.by.group=\u30b0\u30eb\u30fc\u30d7\u3067\u8ffd\u52a0
 label.add.by=\u8ffd\u52a0\u5358\u4f4d
@@ -309,6 +309,7 @@ label.add.compute.offering=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b
 label.add.direct.iprange=\u76f4\u63a5 IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u8ffd\u52a0
 label.add.disk.offering=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
 label.add.domain=\u30c9\u30e1\u30a4\u30f3\u306e\u8ffd\u52a0
+label.added.new.bigswitch.bcf.controller=\u65b0\u3057\u3044 Big Switch BCF \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f
 label.add.egress.rule=\u9001\u4fe1\u898f\u5247\u306e\u8ffd\u52a0
 label.add.F5.device=F5 \u30c7\u30d0\u30a4\u30b9\u306e\u8ffd\u52a0
 label.add.firewall=\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u898f\u5247\u306e\u8ffd\u52a0
@@ -410,7 +411,8 @@ label.back=\u623b\u308b
 label.bandwidth=\u5e2f\u57df\u5e45
 label.basic.mode=\u57fa\u672c\u30e2\u30fc\u30c9
 label.basic=\u57fa\u672c
-label.bigswitch.controller.address=Big Switch VNS \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc \u30a2\u30c9\u30ec\u30b9
+label.bigswitch.controller.address=Big Switch BCF \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30a2\u30c9\u30ec\u30b9
+label.bigswitch.bcf.details=Big Switch BCF \u306e\u8a73\u7d30
 label.bootable=\u8d77\u52d5\u53ef\u80fd
 label.broadcast.domain.range=\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 \u30c9\u30e1\u30a4\u30f3\u306e\u7bc4\u56f2
 label.broadcast.domain.type=\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 \u30c9\u30e1\u30a4\u30f3\u306e\u7a2e\u985e
@@ -503,7 +505,7 @@ label.default.use=\u30c7\u30d5\u30a9\u30eb\u30c8\u4f7f\u7528
 label.default.view=\u30c7\u30d5\u30a9\u30eb\u30c8 \u30d3\u30e5\u30fc
 label.default=\u30c7\u30d5\u30a9\u30eb\u30c8
 label.delete.affinity.group=\u30a2\u30d5\u30a3\u30cb\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7\u306e\u524a\u9664
-label.delete.BigSwitchVns=Big Switch VNS \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u524a\u9664
+label.delete.BigSwitchBcf=Big Switch BCF \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u524a\u9664
 label.delete.F5=F5 \u306e\u524a\u9664
 label.delete.gateway=\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u524a\u9664
 label.delete.NetScaler=NetScaler \u306e\u524a\u9664

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index 5886388..a949adc 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -241,7 +241,7 @@ label.add.accounts=\uacc4\uc815 \uc815\ubcf4 \ucd94\uac00
 label.add.account.to.project=\uacc4\uc815 \uc815\ubcf4 \ud504\ub85c\uc81d\ud2b8\uc5d0 \ucd94\uac00
 label.add.account=\uacc4\uc815 \uc815\ubcf4 \ucd94\uac00
 label.add.ACL=\uad8c\ud55c \uad00\ub9ac(ACL) \ucd94\uac00
-label.add.BigSwitchVns.device=BigSwitch Vns \ucf58\ud2b8\ub864\ub7ec
+label.add.BigSwitchBcf.device=BigSwitch BCF \ucf58\ud2b8\ub864\ub7ec
 label.add.by.cidr=CIDR \ub85c \ucd94\uac00
 label.add.by.group=\uadf8\ub8f9\uc5d0\uc11c \ucd94\uac00
 label.add.by=\ucd94\uac00 \ub2e8\uc704

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_nl_NL.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties
index 64789c2..425ccbb 100644
--- a/client/WEB-INF/classes/resources/messages_nl_NL.properties
+++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties
@@ -252,7 +252,7 @@ label.add.account=Voeg Account toe
 label.add.ACL=Voeg ACL toe
 label.add.affinity.group=Nieuwe affinity groep toevoegen
 label.add.baremetal.dhcp.device=Voeg Baremetal DHCP Apparaat toe
-label.add.BigSwitchVns.device=Voeg BigSwitch Vns Controller toe
+label.add.BigSwitchBcf.device=Voeg BigSwitch BCF Controller toe
 label.add.by.cidr=Voeg toe door middel van CIDR
 label.add.by.group=Voeg toe door middel van Groep
 label.add.by=Voeg toe door middel van
@@ -261,7 +261,7 @@ label.add.compute.offering=Voeg Compute aanbieding toe
 label.add.direct.iprange=Voeg Direct IP Range toe
 label.add.disk.offering=Voeg Schijf Aanbieding toe
 label.add.domain=Voeg Domein toe
-label.added.new.bigswitch.vns.controller=Nieuwe BigSwitch VNS Controller toegevoegd
+label.added.new.bigswitch.bcf.controller=Nieuwe BigSwitch BCF Controller toegevoegd
 label.added.nicira.nvp.controller=Nieuwe Nicira NVP Controller toegevoegd
 label.add.egress.rule=Voeg uitgaande regel toe
 label.addes.new.f5=Nieuwe F5 toegevoegd
@@ -384,8 +384,8 @@ label.baremetal.pxe.device=Voeg Baremetal PXE Apparaat toe
 label.baremetal.pxe.provider=Baremetal PXE Provider
 label.basic=Basis
 label.basic.mode=Basis Modus
-label.bigswitch.controller.address=BigSwitch Vns Controller Adres
-label.bigswitch.vns.details=BigSwitch VNS details
+label.bigswitch.controller.address=BigSwitch BCF Controller Adres
+label.bigswitch.bcf.details=BigSwitch BCF details
 label.blade.id=Blade ID
 label.blades=Blades
 label.bootable=Bootable
@@ -502,7 +502,7 @@ label.default.use=Standaard Gebruik
 label.default.view=Standaard Weergave
 label.delete.affinity.group=Verwijder Affinity Groep
 label.delete.alerts=Verwijder waarschuwingen
-label.delete.BigSwitchVns=Verwijder BigSwitch Vns Controller
+label.delete.BigSwitchBcf=Verwijder BigSwitch Bcf Controller
 label.delete.ciscovnmc.resource=CiscoVNMC resource verwijderen
 label.delete.events=Verwijder gebeurtenissen
 label.delete.F5=Verwijder F5

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index 40b7b12..00dd4bf 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -249,7 +249,7 @@ label.add.account.to.project=Adicionar conta ao projeto
 label.add.ACL=Adicionar ACL
 label.add=Adicionar
 label.add.affinity.group=Adicionar um grupo de afinidade
-label.add.BigSwitchVns.device=Adicionar BigSwitch Vns Controller
+label.add.BigSwitchBcf.device=Adicionar BigSwitch BCF Controller
 label.add.by=Adicionado por
 label.add.by.cidr=Adicionar por CIDR
 label.add.by.group=Adicionar por Grupo
@@ -360,7 +360,7 @@ label.back=Voltar
 label.bandwidth=Bandwidth
 label.basic=B\u00e1sico
 label.basic.mode=Modo B\u00e1sico
-label.bigswitch.controller.address=Endere\u00e7o do Controlador BigSwitch Vns
+label.bigswitch.controller.address=Endere\u00e7o do Controlador BigSwitch BCF
 label.bootable=Inicializ\u00e1vel
 label.broadcast.domain.range=Range do dom\u00ednio de Broadcast
 label.broadcast.domain.type=Tipo de Dom\u00ednio Broadcast
@@ -456,7 +456,7 @@ label.default.use=Uso padr\u00e3o
 label.default.view=Vis\u00e3o Padr\u00e3o
 label.delete.affinity.group=Deletar Grupo de Afinidade
 label.delete.alerts=Remover alertas
-label.delete.BigSwitchVns=Remover Controlador BigSwitch Vns
+label.delete.BigSwitchBcf=Remover Controlador BigSwitch BCF
 label.delete.events=Remover eventos
 label.delete.F5=Remover F5
 label.delete.gateway=delete gateway

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index 085af0f..abaee9e 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -245,7 +245,7 @@ label.add.account.to.project=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u
 label.add.account=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442
 label.add.ACL=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c ACL
 label.add.affinity.group=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e affinity group
-label.add.BigSwitchVns.device=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c BigSwitch Vns Controller
+label.add.BigSwitchBcf.device=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c BigSwitch BCF Controller
 label.add.by.cidr=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a CIDR
 label.add.by.group=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0433\u0440\u0443\u043f\u043f\u0435
 label.add.by=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c
@@ -442,7 +442,7 @@ label.default.use=\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\
 label.default.view=\u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u0438\u0434
 label.delete.affinity.group=\u0423\u0434\u0430\u043b\u0438\u0442\u044c affinity group
 label.delete.alerts=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0432\u043e\u0433\u0438
-label.delete.BigSwitchVns=\u0423\u0434\u0430\u043b\u0438\u0442\u044c BigSwitch VNC \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440
+label.delete.BigSwitchBcf=\u0423\u0434\u0430\u043b\u0438\u0442\u044c BigSwitch BCF \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440
 label.delete.events=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f
 label.delete.F5=\u0423\u0434\u0430\u043b\u0438\u0442\u044c F5
 label.delete.gateway=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0448\u043b\u044e\u0437

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index 52e18cc..4e750aa 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -300,7 +300,7 @@ label.add.accounts.to=\u6dfb\u52a0\u5e10\u6237\u81f3
 label.add.accounts=\u6dfb\u52a0\u5e10\u6237
 label.add.ACL=\u6dfb\u52a0 ACL
 label.add.affinity.group=\u6dfb\u52a0\u65b0\u5173\u8054\u6027\u7ec4
-label.add.BigSwitchVns.device=\u6dfb\u52a0 BigSwitch Vns \u63a7\u5236\u5668
+label.add.BigSwitchBcf.device=\u6dfb\u52a0 BigSwitch BCF \u63a7\u5236\u5668
 label.add.by.cidr=\u6309 CIDR \u6dfb\u52a0
 label.add.by.group=\u6309\u7ec4\u6dfb\u52a0
 label.add.by=\u6dfb\u52a0\u65b9\u5f0f
@@ -309,6 +309,7 @@ label.add.compute.offering=\u6dfb\u52a0\u8ba1\u7b97\u65b9\u6848
 label.add.direct.iprange=\u6dfb\u52a0\u76f4\u63a5 IP \u8303\u56f4
 label.add.disk.offering=\u6dfb\u52a0\u78c1\u76d8\u65b9\u6848
 label.add.domain=\u6dfb\u52a0\u57df
+label.added.new.bigswitch.bcf.controller=\u5df2\u6dfb\u52a0\u65b0 BigSwitch BCF \u63a7\u5236\u5668
 label.add.egress.rule=\u6dfb\u52a0\u51fa\u53e3\u89c4\u5219
 label.add.F5.device=\u6dfb\u52a0 F5 \u8bbe\u5907
 label.add.firewall=\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219
@@ -410,7 +411,8 @@ label.back=\u540e\u9000
 label.bandwidth=\u5e26\u5bbd
 label.basic.mode=\u57fa\u672c\u6a21\u5f0f
 label.basic=\u57fa\u672c
-label.bigswitch.controller.address=BigSwitch Vns \u63a7\u5236\u5668\u5730\u5740
+label.bigswitch.controller.address=BigSwitch BCF \u63a7\u5236\u5668\u5730\u5740
+label.bigswitch.bcf.details=BigSwitch BCF \u8be6\u7ec6\u4fe1\u606f
 label.bootable=\u53ef\u542f\u52a8
 label.broadcast.domain.range=\u5e7f\u64ad\u57df\u8303\u56f4
 label.broadcast.domain.type=\u5e7f\u64ad\u57df\u7c7b\u578b
@@ -503,7 +505,7 @@ label.default.use=\u9ed8\u8ba4\u4f7f\u7528
 label.default.view=\u9ed8\u8ba4\u89c6\u56fe
 label.default=\u9ed8\u8ba4\u8bbe\u7f6e
 label.delete.affinity.group=\u5220\u9664\u5173\u8054\u6027\u7ec4
-label.delete.BigSwitchVns=\u79fb\u9664 BigSwitch Vns \u63a7\u5236\u5668
+label.delete.BigSwitchBcf=\u79fb\u9664 BigSwitch BCF \u63a7\u5236\u5668
 label.delete.F5=\u5220\u9664 F5
 label.delete.gateway=\u5220\u9664\u7f51\u5173
 label.delete.NetScaler=\u5220\u9664 NetScaler

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 262a340..3dbc0a0 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -127,7 +127,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-plugin-network-vns</artifactId>
+      <artifactId>cloud-plugin-network-bigswitch</artifactId>
       <version>${project.version}</version>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index f932904..ee8537e 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -626,11 +626,11 @@ deleteBrocadeVcsDevice=1
 listBrocadeVcsDevices=1
 listBrocadeVcsDeviceNetworks=1
 
-#### bigswitch vns commands
+#### bigswitch bcf commands
 
-addBigSwitchVnsDevice=1
-deleteBigSwitchVnsDevice=1
-listBigSwitchVnsDevices=1
+addBigSwitchBcfDevice=1
+deleteBigSwitchBcfDevice=1
+listBigSwitchBcfDevices=1
 
 #### stratosphere ssp commands
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/engine/schema/src/com/cloud/user/dao/VmDiskStatisticsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/VmDiskStatisticsDaoImpl.java b/engine/schema/src/com/cloud/user/dao/VmDiskStatisticsDaoImpl.java
index e1136d3..56a1d3e 100644
--- a/engine/schema/src/com/cloud/user/dao/VmDiskStatisticsDaoImpl.java
+++ b/engine/schema/src/com/cloud/user/dao/VmDiskStatisticsDaoImpl.java
@@ -40,8 +40,8 @@ import com.cloud.utils.db.TransactionLegacy;
 public class VmDiskStatisticsDaoImpl extends GenericDaoBase<VmDiskStatisticsVO, Long> implements VmDiskStatisticsDao {
     private static final Logger s_logger = Logger.getLogger(VmDiskStatisticsDaoImpl.class);
     private static final String ACTIVE_AND_RECENTLY_DELETED_SEARCH =
-        "SELECT vns.id, vns.data_center_id, vns.account_id, vns.vm_id, vns.volume_id, vns.agg_io_read, vns.agg_io_write, vns.agg_bytes_read, vns.agg_bytes_write "
-            + "FROM vm_disk_statistics vns, account a " + "WHERE vns.account_id = a.id AND (a.removed IS NULL OR a.removed >= ?) " + "ORDER BY vns.id";
+        "SELECT bcf.id, bcf.data_center_id, bcf.account_id, bcf.vm_id, bcf.volume_id, bcf.agg_io_read, bcf.agg_io_write, bcf.agg_bytes_read, bcf.agg_bytes_write "
+            + "FROM vm_disk_statistics bcf, account a " + "WHERE bcf.account_id = a.id AND (a.removed IS NULL OR a.removed >= ?) " + "ORDER BY bcf.id";
     private static final String UPDATED_VM_NETWORK_STATS_SEARCH = "SELECT id, current_io_read, current_io_write, net_io_read, net_io_write, agg_io_read, agg_io_write, "
         + "current_bytes_read, current_bytes_write, net_bytes_read, net_bytes_write, agg_bytes_read, agg_bytes_write " + "from  vm_disk_statistics "
         + "where (agg_io_read < net_io_read + current_io_read) OR (agg_io_write < net_io_write + current_io_write) OR "

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/framework/rest/.gitignore
----------------------------------------------------------------------
diff --git a/framework/rest/.gitignore b/framework/rest/.gitignore
index ea8c4bf..19f2e00 100644
--- a/framework/rest/.gitignore
+++ b/framework/rest/.gitignore
@@ -1 +1,2 @@
 /target
+/target

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
new file mode 100644
index 0000000..b503674
--- /dev/null
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.cloud.hypervisor.kvm.resource;
+
+import java.io.File;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.libvirt.LibvirtException;
+
+import com.cloud.agent.api.to.NicTO;
+import com.cloud.exception.InternalErrorException;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
+import com.cloud.network.Networks;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.net.NetUtils;
+import com.cloud.utils.script.OutputInterpreter;
+import com.cloud.utils.script.Script;
+
+public class IvsVifDriver extends VifDriverBase {
+    private static final Logger s_logger = Logger.getLogger(IvsVifDriver.class);
+    private int _timeout;
+
+    private final Object _vnetBridgeMonitor = new Object();
+    private String _modifyVlanPath;
+    private String _modifyVxlanPath;
+    private String _ivsIfUpPath;
+    private Long libvirtVersion;
+
+    @Override
+    public void configure(Map<String, Object> params) throws ConfigurationException {
+        super.configure(params);
+        String networkScriptsDir = (String)params.get("network.scripts.dir");
+        if (networkScriptsDir == null) {
+            networkScriptsDir = "scripts/vm/network/vnet";
+        }
+        String utilScriptsDir = "scripts/util/";
+
+        String value = (String)params.get("scripts.timeout");
+        _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
+
+        _modifyVlanPath = Script.findScript(networkScriptsDir, "modifyvlan.sh");
+        if (_modifyVlanPath == null) {
+            throw new ConfigurationException("Unable to find modifyvlan.sh");
+        }
+        _modifyVxlanPath = Script.findScript(networkScriptsDir, "modifyvxlan.sh");
+        if (_modifyVxlanPath == null) {
+            throw new ConfigurationException("Unable to find modifyvxlan.sh");
+        }
+        _ivsIfUpPath = Script.findScript(utilScriptsDir, "qemu-ivs-ifup");
+
+        libvirtVersion = (Long) params.get("libvirtVersion");
+        if (libvirtVersion == null) {
+            libvirtVersion = 0L;
+        }
+
+        createControlNetwork(_bridges.get("linklocal"));
+    }
+
+    @Override
+    public InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter) throws InternalErrorException, LibvirtException {
+        LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
+
+        String vNetId = null;
+        String protocol = null;
+        if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan) {
+            vNetId = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
+            protocol = Networks.BroadcastDomainType.getSchemeValue(nic.getBroadcastUri()).scheme();
+        }
+
+        String vlanId = null;
+        String logicalSwitchUuid = null;
+        if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) {
+            vlanId = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
+        } else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
+            logicalSwitchUuid = Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
+        } else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) {
+            // TODO consider moving some of this functionality from NetUtils to Networks....
+            vlanId = NetUtils.getPrimaryPvlanFromUri(nic.getBroadcastUri());
+        }
+        String trafficLabel = nic.getName();
+        Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
+        if (nic.getType() == Networks.TrafficType.Guest) {
+            if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) &&
+                    !vlanId.equalsIgnoreCase("untagged")) {
+                if (trafficLabel != null && !trafficLabel.isEmpty()) {
+                    s_logger.debug("creating a vlan dev and bridge for guest traffic per traffic label " + trafficLabel);
+                    intf.defEthernet("ivsnet-" + nic.getUuid().substring(0, 5), nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), _ivsIfUpPath, networkRateKBps);
+                } else {
+                    throw new InternalErrorException("no traffic label ");
+                }
+            }
+        } else if (nic.getType() == Networks.TrafficType.Control) {
+            /* Make sure the network is still there */
+            createControlNetwork();
+            intf.defBridgeNet(_bridges.get("linklocal"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
+        } else if (nic.getType() == Networks.TrafficType.Public) {
+            if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) && (vNetId != null) && (protocol != null) && (!vNetId.equalsIgnoreCase("untagged")) ||
+                    (nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan)) {
+                if (trafficLabel != null && !trafficLabel.isEmpty()) {
+                    s_logger.debug("creating a vNet dev and bridge for public traffic per traffic label " + trafficLabel);
+                    String brName = createVnetBr(vNetId, trafficLabel, protocol);
+                    intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
+                } else {
+                    String brName = createVnetBr(vNetId, "public", protocol);
+                    intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
+                }
+            } else {
+                intf.defBridgeNet(_bridges.get("public"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
+            }
+        } else if (nic.getType() == Networks.TrafficType.Management) {
+            intf.defBridgeNet(_bridges.get("private"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
+        } else if (nic.getType() == Networks.TrafficType.Storage) {
+            String storageBrName = nic.getName() == null ? _bridges.get("private") : nic.getName();
+            intf.defBridgeNet(storageBrName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter));
+        }
+        if (nic.getPxeDisable() == true) {
+            intf.setPxeDisable(true);
+        }
+        return intf;
+    }
+
+    @Override
+    public void unplug(InterfaceDef iface) {
+    }
+
+    private void createControlNetwork() throws LibvirtException {
+        createControlNetwork(_bridges.get("linklocal"));
+    }
+
+    private String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
+        String nic = _pifs.get(pifKey);
+        if (nic == null) {
+            // if not found in bridge map, maybe traffic label refers to pif already?
+            File pif = new File("/sys/class/net/" + pifKey);
+            if (pif.isDirectory()) {
+                nic = pifKey;
+            }
+        }
+        String brName = "";
+        brName = setVnetBrName(nic, vNetId);
+        createVnet(vNetId, nic, brName, protocol);
+        return brName;
+    }
+
+    private String setVnetBrName(String pifName, String vnetId) {
+        return "br" + pifName + "-" + vnetId;
+    }
+
+    private void createVnet(String vnetId, String pif, String brName, String protocol) throws InternalErrorException {
+        synchronized (_vnetBridgeMonitor) {
+            String script = _modifyVlanPath;
+            if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
+                script = _modifyVxlanPath;
+            }
+            final Script command = new Script(script, _timeout, s_logger);
+            command.add("-v", vnetId);
+            command.add("-p", pif);
+            command.add("-b", brName);
+            command.add("-o", "add");
+
+            final String result = command.execute();
+            if (result != null) {
+                throw new InternalErrorException("Failed to create vnet " + vnetId + ": " + result);
+            }
+        }
+    }
+
+    private void deleteVnetBr(String brName) {
+        synchronized (_vnetBridgeMonitor) {
+            String cmdout = Script.runSimpleBashScript("ls /sys/class/net/" + brName);
+            if (cmdout == null)
+                // Bridge does not exist
+                return;
+            cmdout = Script.runSimpleBashScript("ls /sys/class/net/" + brName + "/brif | tr '\n' ' '");
+            if (cmdout != null && cmdout.contains("vnet")) {
+                // Active VM remains on that bridge
+                return;
+            }
+
+            Pattern oldStyleBrNameRegex = Pattern.compile("^cloudVirBr(\\d+)$");
+            Pattern brNameRegex = Pattern.compile("^br(\\S+)-(\\d+)$");
+            Matcher oldStyleBrNameMatcher = oldStyleBrNameRegex.matcher(brName);
+            Matcher brNameMatcher = brNameRegex.matcher(brName);
+
+            String pName = null;
+            String vNetId = null;
+            if (oldStyleBrNameMatcher.find()) {
+                // Actually modifyvlan.sh doesn't require pif name when deleting its bridge so far.
+                pName = "undefined";
+                vNetId = oldStyleBrNameMatcher.group(1);
+            } else if (brNameMatcher.find()) {
+                if (brNameMatcher.group(1) != null || !brNameMatcher.group(1).isEmpty()) {
+                    pName = brNameMatcher.group(1);
+                } else {
+                    pName = "undefined";
+                }
+                vNetId = brNameMatcher.group(2);
+            }
+
+            if (vNetId == null || vNetId.isEmpty()) {
+                s_logger.debug("unable to get a vNet ID from name " + brName);
+                return;
+            }
+
+            String scriptPath = null;
+            if (cmdout != null && cmdout.contains("vxlan")) {
+                scriptPath = _modifyVxlanPath;
+            } else {
+                scriptPath = _modifyVlanPath;
+            }
+
+            final Script command = new Script(scriptPath, _timeout, s_logger);
+            command.add("-o", "delete");
+            command.add("-v", vNetId);
+            command.add("-p", pName);
+            command.add("-b", brName);
+
+            final String result = command.execute();
+            if (result != null) {
+                s_logger.debug("Delete bridge " + brName + " failed: " + result);
+            }
+        }
+    }
+
+    private void deleteExitingLinkLocalRouteTable(String linkLocalBr) {
+        Script command = new Script("/bin/bash", _timeout);
+        command.add("-c");
+        command.add("ip route | grep " + NetUtils.getLinkLocalCIDR());
+        OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
+        String result = command.execute(parser);
+        boolean foundLinkLocalBr = false;
+        if (result == null && parser.getLines() != null) {
+            String[] lines = parser.getLines().split("\\n");
+            for (String line : lines) {
+                String[] tokens = line.split(" ");
+                if (!tokens[2].equalsIgnoreCase(linkLocalBr)) {
+                    Script.runSimpleBashScript("ip route del " + NetUtils.getLinkLocalCIDR());
+                } else {
+                    foundLinkLocalBr = true;
+                }
+            }
+        }
+        if (!foundLinkLocalBr) {
+            Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
+                NetUtils.getLinkLocalGateway());
+        }
+    }
+
+    private void createControlNetwork(String privBrName) {
+        deleteExitingLinkLocalRouteTable(privBrName);
+        if (!isBridgeExists(privBrName)) {
+            Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout);
+        }
+    }
+
+    private boolean isBridgeExists(String bridgeName) {
+        File f = new File("/sys/devices/virtual/net/" + bridgeName);
+        if (f.exists()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/pom.xml b/plugins/network-elements/bigswitch-vns/pom.xml
deleted file mode 100644
index afb267c..0000000
--- a/plugins/network-elements/bigswitch-vns/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>cloud-plugin-network-vns</artifactId>
-  <name>Apache CloudStack Plugin - BigSwitch Virtual Network Segment</name>
-  <parent>
-    <groupId>org.apache.cloudstack</groupId>
-    <artifactId>cloudstack-plugins</artifactId>
-    <version>4.6.0-SNAPSHOT</version>
-    <relativePath>../../pom.xml</relativePath>
-  </parent>
-</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/module.properties
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/module.properties b/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/module.properties
deleted file mode 100644
index 5783d38..0000000
--- a/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/module.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-name=vns
-parent=network
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/spring-vns-context.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/spring-vns-context.xml b/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/spring-vns-context.xml
deleted file mode 100644
index d5bb92a..0000000
--- a/plugins/network-elements/bigswitch-vns/resources/META-INF/cloudstack/vns/spring-vns-context.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-                      http://www.springframework.org/schema/context
-                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
-                      >
-
-    <bean id="bigSwitchVnsDaoImpl" class="com.cloud.network.dao.BigSwitchVnsDaoImpl" />
-    <bean id="bigSwitchVnsElement" class="com.cloud.network.element.BigSwitchVnsElement">
-        <property name="name" value="BigSwitchVnsElement" />
-    </bean>
-
-
-</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java
deleted file mode 100644
index e950abe..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class CreateVnsNetworkAnswer extends Answer {
-
-    public CreateVnsNetworkAnswer(Command command, boolean success, String details) {
-        super(command, success, details);
-    }
-
-    public CreateVnsNetworkAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java
deleted file mode 100644
index 534bb7f..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class CreateVnsNetworkCommand extends Command {
-    private String _networkUuid;
-    private String _name;
-    private String _tenantUuid;
-    private int _vlan;
-
-    public CreateVnsNetworkCommand(String networkUuid, String name, String tenantUuid, int vlan) {
-        this._networkUuid = networkUuid;
-        this._name = name;
-        this._tenantUuid = tenantUuid;
-        this._vlan = vlan;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getNetworkUuid() {
-        return _networkUuid;
-    }
-
-    public String getName() {
-        return _name;
-    }
-
-    public String getTenantUuid() {
-        return _tenantUuid;
-    }
-
-    public int getVlan() {
-        return _vlan;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java
deleted file mode 100644
index 82c2fe9..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class CreateVnsPortAnswer extends Answer {
-
-    public CreateVnsPortAnswer(Command command, boolean success, String details) {
-        super(command, success, details);
-    }
-
-    public CreateVnsPortAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java
deleted file mode 100644
index c3b9a9d..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class CreateVnsPortCommand extends Command {
-    private String _networkUuid;
-    private String _portUuid;
-    private String _tenantUuid;
-    private String _portName;
-    private String _mac;
-
-    public CreateVnsPortCommand(String networkUuid, String portUuid, String tenantUuid, String portName, String mac) {
-        this._networkUuid = networkUuid;
-        this._portUuid = portUuid;
-        this._tenantUuid = tenantUuid;
-        this._portName = portName;
-        this._mac = mac;
-    }
-
-    public String getNetworkUuid() {
-        return _networkUuid;
-    }
-
-    public String getPortUuid() {
-        return _portUuid;
-    }
-
-    public String getTenantUuid() {
-        return _tenantUuid;
-    }
-
-    public String getPortName() {
-        return _portName;
-    }
-
-    public String getMac() {
-        return _mac;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java
deleted file mode 100644
index 72ac98a..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class DeleteVnsNetworkAnswer extends Answer {
-
-    public DeleteVnsNetworkAnswer(Command command, boolean success, String details) {
-        super(command, success, details);
-    }
-
-    public DeleteVnsNetworkAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java
deleted file mode 100644
index 6cf169b..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class DeleteVnsNetworkCommand extends Command {
-
-    private String _tenantUuid;
-    private String _networkUuid;
-
-    public DeleteVnsNetworkCommand(String tenantUuid, String networkUuid) {
-        this._tenantUuid = tenantUuid;
-        this._networkUuid = networkUuid;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String get_tenantUuid() {
-        return _tenantUuid;
-    }
-
-    public String getNetworkUuid() {
-        return _networkUuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java
deleted file mode 100644
index 076b187..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class DeleteVnsPortAnswer extends Answer {
-
-    public DeleteVnsPortAnswer(Command command, boolean success, String details) {
-        super(command, success, details);
-    }
-
-    public DeleteVnsPortAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java
deleted file mode 100644
index 0cae01d..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class DeleteVnsPortCommand extends Command {
-
-    private String _networkUuid;
-    private String _portUuid;
-    private String _tenantUuid;
-
-    public DeleteVnsPortCommand(String networkUuid, String portUuid, String tenantUuid) {
-        this._networkUuid = networkUuid;
-        this._portUuid = portUuid;
-        this._tenantUuid = tenantUuid;
-    }
-
-    public String getNetworkUuid() {
-        return _networkUuid;
-    }
-
-    public String getPortUuid() {
-        return _portUuid;
-    }
-
-    public String getTenantUuid() {
-        return _tenantUuid;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java
deleted file mode 100644
index 8310b07..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupBigSwitchVnsCommand extends StartupCommand {
-
-    public StartupBigSwitchVnsCommand() {
-        super(Host.Type.L2Networking);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java
deleted file mode 100644
index 39cd266..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class UpdateVnsPortAnswer extends Answer {
-
-    public UpdateVnsPortAnswer(Command command, boolean success, String details) {
-        super(command, success, details);
-    }
-
-    public UpdateVnsPortAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java
deleted file mode 100644
index 40f0920..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class UpdateVnsPortCommand extends Command {
-    private String _networkUuid;
-    private String _portUuid;
-    private String _tenantUuid;
-    private String _portName;
-
-    public UpdateVnsPortCommand(String networkUuid, String portUuid, String tenantUuid, String portName) {
-        this._networkUuid = networkUuid;
-        this._portUuid = portUuid;
-        this._tenantUuid = tenantUuid;
-        this._portName = portName;
-    }
-
-    public String getNetworkUuid() {
-        return _networkUuid;
-    }
-
-    public String getPortUuid() {
-        return _portUuid;
-    }
-
-    public String getTenantUuid() {
-        return _tenantUuid;
-    }
-
-    public String getPortName() {
-        return _portName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java
deleted file mode 100644
index 5c6f555..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import com.cloud.api.response.BigSwitchVnsDeviceResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.network.element.BigSwitchVnsElementService;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@APICommand(name = "addBigSwitchVnsDevice", responseObject = BigSwitchVnsDeviceResponse.class, description = "Adds a BigSwitch VNS device", since = "4.1.0",
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class AddBigSwitchVnsDeviceCmd extends BaseAsyncCmd {
-    private static final String s_name = "addbigswitchvnsdeviceresponse";
-    @Inject
-    BigSwitchVnsElementService _bigswitchVnsElementService;
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID,
-               type = CommandType.UUID,
-               entityType = PhysicalNetworkResponse.class,
-               required = true,
-               description = "the Physical Network ID")
-    private Long physicalNetworkId;
-
-    @Parameter(name = ApiConstants.HOST_NAME, type = CommandType.STRING, required = true, description = "Hostname of ip address of the BigSwitch VNS Controller.")
-    private String host;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getPhysicalNetworkId() {
-        return physicalNetworkId;
-    }
-
-    public String getHost() {
-        return host;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
-        ResourceAllocationException {
-        try {
-            BigSwitchVnsDeviceVO bigswitchVnsDeviceVO = _bigswitchVnsElementService.addBigSwitchVnsDevice(this);
-            if (bigswitchVnsDeviceVO != null) {
-                BigSwitchVnsDeviceResponse response = _bigswitchVnsElementService.createBigSwitchVnsDeviceResponse(bigswitchVnsDeviceVO);
-                response.setObjectName("bigswitchvnsdevice");
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add BigSwitch VNS device due to internal error.");
-            }
-        } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
-        } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return CallContext.current().getCallingAccount().getId();
-    }
-
-    @Override
-    public String getEventType() {
-        return VnsConstants.EVENT_EXTERNAL_VNS_CONTROLLER_ADD;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Adding a BigSwitch VNS Controller";
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
deleted file mode 100644
index 1e2155d..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import com.cloud.api.response.BigSwitchVnsDeviceResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.element.BigSwitchVnsElementService;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@APICommand(name = "deleteBigSwitchVnsDevice", responseObject = SuccessResponse.class, description = " delete a bigswitch vns device", since = "4.1.0",
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class DeleteBigSwitchVnsDeviceCmd extends BaseAsyncCmd {
-    private static final String s_name = "deletebigswitchvnsdeviceresponse";
-    @Inject
-    BigSwitchVnsElementService _bigswitchVnsElementService;
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name = VnsConstants.BIGSWITCH_VNS_DEVICE_ID,
-               type = CommandType.UUID,
-               entityType = BigSwitchVnsDeviceResponse.class,
-               required = true,
-               description = "BigSwitch device ID")
-    private Long bigswitchVnsDeviceId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getBigSwitchVnsDeviceId() {
-        return bigswitchVnsDeviceId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
-        ResourceAllocationException {
-        try {
-            boolean result = _bigswitchVnsElementService.deleteBigSwitchVnsDevice(this);
-            if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete BigSwitch device.");
-            }
-        } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
-        } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return CallContext.current().getCallingAccount().getId();
-    }
-
-    @Override
-    public String getEventType() {
-        return VnsConstants.EVENT_EXTERNAL_VNS_CONTROLLER_DELETE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Deleting BigSwitch Vns Controller";
-    }
-
-}


[28/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-7593: allow nic type to be fetched from vm's details

(cherry picked from commit 43db75c319b425f3b39770d556df59333921bf92)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>

Conflicts:
	engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/37820e15
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/37820e15
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/37820e15

Branch: refs/heads/reporter
Commit: 37820e15f2ac5bb4222cd2f7ef5da63e97d5de8a
Parents: c158cff
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 14:25:34 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:03 2015 +0530

----------------------------------------------------------------------
 core/src/com/cloud/agent/api/PlugNicCommand.java      | 14 ++++++++++++++
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java   |  3 +--
 .../hypervisor/vmware/resource/VmwareResource.java    |  6 +++++-
 3 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37820e15/core/src/com/cloud/agent/api/PlugNicCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PlugNicCommand.java b/core/src/com/cloud/agent/api/PlugNicCommand.java
index e68931d..322b755 100644
--- a/core/src/com/cloud/agent/api/PlugNicCommand.java
+++ b/core/src/com/cloud/agent/api/PlugNicCommand.java
@@ -22,11 +22,14 @@ package com.cloud.agent.api;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.vm.VirtualMachine;
 
+import java.util.Map;
+
 public class PlugNicCommand extends Command {
 
     NicTO nic;
     String instanceName;
     VirtualMachine.Type vmType;
+    Map<String, String> details;
 
     public NicTO getNic() {
         return nic;
@@ -46,6 +49,13 @@ public class PlugNicCommand extends Command {
         this.vmType = vmtype;
     }
 
+    public PlugNicCommand(NicTO nic, String instanceName, VirtualMachine.Type vmtype, Map<String, String> details) {
+        this.nic = nic;
+        this.instanceName = instanceName;
+        this.vmType = vmtype;
+        this.details = details;
+    }
+
     public String getVmName() {
         return instanceName;
     }
@@ -53,4 +63,8 @@ public class PlugNicCommand extends Command {
     public VirtualMachine.Type getVMType() {
         return vmType;
     }
+
+    public Map<String, String> getDetails() {
+        return this.details;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37820e15/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 3426a0a..f6280c2 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3422,8 +3422,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         final VMInstanceVO router = _vmDao.findById(vm.getId());
         if (router.getState() == State.Running) {
             try {
-                final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType());
-
+                final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType(), vm.getDetails());
                 final Commands cmds = new Commands(Command.OnError.Stop);
                 cmds.addCommand("plugnic", plugNicCmd);
                 _agentMgr.send(dest.getHost().getId(), cmds);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37820e15/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index f90a666..07815ee 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -916,8 +916,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
             }
              */
-            // TODO need a way to specify the control of NIC device type
+            // Fallback to E1000 if no specific nicAdapter is passed
             VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
+            Map details = cmd.getDetails();
+            if (details != null) {
+                nicDeviceType = VirtualEthernetCardType.valueOf((String) details.get("nicAdapter"));
+            }
 
             // find a usable device number in VMware environment
             VirtualDevice[] nicDevices = vmMo.getNicDevices();


[26/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
rat: readable license in pom.xml

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c158cff6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c158cff6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c158cff6

Branch: refs/heads/reporter
Commit: c158cff68c50cb3652603ec8edf531592c7d6f55
Parents: e459ccf
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:03:02 2015 -0500
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:03:02 2015 -0500

----------------------------------------------------------------------
 plugins/pom.xml | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c158cff6/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index a547e1e..7368d20 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -1,13 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-  license agreements. See the NOTICE file distributed with this work for additional 
-  information regarding copyright ownership. The ASF licenses this file to you under 
-  the Apache License, Version 2.0 (the "License"); you may not use this file except 
-  in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
-  Unless required by applicable law or agreed to in writing, software distributed under 
-  the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-  OF ANY KIND, either express or implied. See the License for the specific language 
-  governing permissions and limitations under the License. -->
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>


[14/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Add *.md to the RAT exclude list


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/559b0149
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/559b0149
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/559b0149

Branch: refs/heads/reporter
Commit: 559b014953aef5f0ae8abf62244753a9dfd3dd51
Parents: 66cded7
Author: Ian Duffy <ia...@ianduffy.ie>
Authored: Sat Apr 11 16:23:03 2015 +0100
Committer: Ian Duffy <ia...@ianduffy.ie>
Committed: Sat Apr 11 16:23:03 2015 +0100

----------------------------------------------------------------------
 pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/559b0149/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7cf6735..175394c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -843,6 +843,7 @@
               <exclude>tools/ngui/static/js/lib/*</exclude>
               <exclude>**/.checkstyle</exclude>
               <exclude>scripts/installer/windows/acs_license.rtf</exclude>
+	      <exclude>**/*.md</exclude>
             </excludes>
           </configuration>
         </plugin>


[16/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: unused retry count causing unintended useless null guard

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/332da26c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/332da26c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/332da26c

Branch: refs/heads/reporter
Commit: 332da26cb9d86984b66c5c6a6595472452dda6ef
Parents: 015eef2
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 19:58:05 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 19:58:05 2015 +0200

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  | 59 ++++++++++----------
 1 file changed, 31 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/332da26c/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index bf0ea6c..bc812e8 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -46,9 +46,6 @@ import javax.naming.ConfigurationException;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
 import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 import org.w3c.dom.Document;
@@ -57,6 +54,35 @@ import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
+import com.trilead.ssh2.SCPClient;
+import com.xensource.xenapi.Bond;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Console;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.HostCpu;
+import com.xensource.xenapi.HostMetrics;
+import com.xensource.xenapi.Network;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.PIF;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Session;
+import com.xensource.xenapi.Task;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VIF;
+import com.xensource.xenapi.VLAN;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.XenAPIObject;
+
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -123,30 +149,6 @@ import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.ssh.SSHCmdHelper;
 import com.cloud.utils.ssh.SshHelper;
 import com.cloud.vm.VirtualMachine.PowerState;
-import com.trilead.ssh2.SCPClient;
-import com.xensource.xenapi.Bond;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Console;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.HostCpu;
-import com.xensource.xenapi.HostMetrics;
-import com.xensource.xenapi.Network;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Session;
-import com.xensource.xenapi.Task;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VmPowerState;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VIF;
-import com.xensource.xenapi.VLAN;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.XenAPIObject;
 
 /**
  * CitrixResourceBase encapsulates the calls to the XenServer Xapi process to
@@ -4862,7 +4864,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         dest.reconfigureIp(conn, spr.ipConfigurationMode, spr.IP, spr.netmask, spr.gateway, spr.DNS);
         Host.managementReconfigure(conn, dest);
         String hostUuid = null;
-        final int count = 0;
+        int count = 0;
         while (count < 10) {
             try {
                 Thread.sleep(10000);
@@ -4870,6 +4872,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 if (hostUuid != null) {
                     break;
                 }
+                ++count;
             } catch (final XmlRpcException e) {
                 s_logger.debug("Waiting for host to come back: " + e.getMessage());
             } catch (final XenAPIException e) {


[46/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
server: ignore params signatureversion and expires when validating API args

(cherry picked from commit d361bf684704719902419d372c6ce31d941abe9e)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c0d3e6f5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c0d3e6f5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c0d3e6f5

Branch: refs/heads/reporter
Commit: c0d3e6f5e8dbe5f2ad917b5209ea8707f02c67ca
Parents: ac06ec0
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Apr 14 15:25:17 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 14 16:52:32 2015 +0530

----------------------------------------------------------------------
 .../src/com/cloud/api/dispatch/ParamGenericValidationWorker.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c0d3e6f5/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
index 7aaafbb..6509d11 100644
--- a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
@@ -90,7 +90,7 @@ public class ParamGenericValidationWorker implements DispatchWorker {
                     break;
                 }
             }
-            if (!matchedCurrentParam) {
+            if (!matchedCurrentParam && !((String)actualParamName).equalsIgnoreCase("expires") && !((String)actualParamName).equalsIgnoreCase("signatureversion")) {
                 errorMsg.append(" ").append(actualParamName);
                 foundUnknownParam= true;
             }


[06/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
deleted file mode 100644
index 4cde78e..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-
-import com.cloud.api.response.BigSwitchVnsDeviceResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.network.element.BigSwitchVnsElementService;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@APICommand(name = "listBigSwitchVnsDevices", responseObject = BigSwitchVnsDeviceResponse.class, description = "Lists BigSwitch Vns devices", since = "4.1.0",
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class ListBigSwitchVnsDevicesCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListBigSwitchVnsDevicesCmd.class.getName());
-    private static final String s_name = "listbigswitchvnsdeviceresponse";
-    @Inject
-    BigSwitchVnsElementService _bigswitchVnsElementService;
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the Physical Network ID")
-    private Long physicalNetworkId;
-
-    @Parameter(name = VnsConstants.BIGSWITCH_VNS_DEVICE_ID,
-               type = CommandType.UUID,
-               entityType = BigSwitchVnsDeviceResponse.class,
-               description = "bigswitch vns device ID")
-    private Long bigswitchVnsDeviceId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getBigSwitchVnsDeviceId() {
-        return bigswitchVnsDeviceId;
-    }
-
-    public Long getPhysicalNetworkId() {
-        return physicalNetworkId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
-        ResourceAllocationException {
-        try {
-            List<BigSwitchVnsDeviceVO> bigswitchDevices = _bigswitchVnsElementService.listBigSwitchVnsDevices(this);
-            ListResponse<BigSwitchVnsDeviceResponse> response = new ListResponse<BigSwitchVnsDeviceResponse>();
-            List<BigSwitchVnsDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchVnsDeviceResponse>();
-
-            if (bigswitchDevices != null && !bigswitchDevices.isEmpty()) {
-                for (BigSwitchVnsDeviceVO bigswitchDeviceVO : bigswitchDevices) {
-                    BigSwitchVnsDeviceResponse bigswitchDeviceResponse = _bigswitchVnsElementService.createBigSwitchVnsDeviceResponse(bigswitchDeviceVO);
-                    bigswitchDevicesResponse.add(bigswitchDeviceResponse);
-                }
-            }
-
-            response.setResponses(bigswitchDevicesResponse);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
-        } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java
deleted file mode 100644
index 7942b6f..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package com.cloud.api.commands;
-
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
-
-import com.cloud.network.Network.Provider;
-
-public class VnsConstants {
-    public static final String BIGSWITCH_VNS_DEVICE_ID = "vnsdeviceid";
-    public static final String BIGSWITCH_VNS_DEVICE_NAME = "bigswitchdevicename";
-
-    public static final String EVENT_EXTERNAL_VNS_CONTROLLER_ADD = "PHYSICAL.VNSCONTROLLER.ADD";
-    public static final String EVENT_EXTERNAL_VNS_CONTROLLER_DELETE = "PHYSICAL.VNSCONTROLLER.DELETE";
-
-    public static final Provider BigSwitchVns = new Provider("BigSwitchVns", true);
-
-    public static final NetworkDevice BigSwitchVnsDevice = new NetworkDevice("BigSwitchVns", BigSwitchVns.getName());
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
deleted file mode 100644
index 790ac9c..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.response;
-
-import com.google.gson.annotations.SerializedName;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.EntityReference;
-
-import com.cloud.api.commands.VnsConstants;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.serializer.Param;
-
-@EntityReference(value = BigSwitchVnsDeviceVO.class)
-public class BigSwitchVnsDeviceResponse extends BaseResponse {
-    @SerializedName(VnsConstants.BIGSWITCH_VNS_DEVICE_ID)
-    @Param(description = "device id of the BigSwitch Vns")
-    private String id;
-
-    @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
-    @Param(description = "the physical network to which this BigSwitch Vns belongs to")
-    private String physicalNetworkId;
-
-    @SerializedName(ApiConstants.PROVIDER)
-    @Param(description = "name of the provider")
-    private String providerName;
-
-    @SerializedName(VnsConstants.BIGSWITCH_VNS_DEVICE_NAME)
-    @Param(description = "device name")
-    private String deviceName;
-
-    @SerializedName(ApiConstants.HOST_NAME)
-    @Param(description = "the controller Ip address")
-    private String hostName;
-
-    public String getId() {
-        return this.id;
-    }
-
-    public void setId(String vnsDeviceId) {
-        this.id = vnsDeviceId;
-    }
-
-    public void setPhysicalNetworkId(String physicalNetworkId) {
-        this.physicalNetworkId = physicalNetworkId;
-    }
-
-    public void setProviderName(String providerName) {
-        this.providerName = providerName;
-    }
-
-    public void setDeviceName(String deviceName) {
-        this.deviceName = deviceName;
-    }
-
-    public void setHostName(String hostName) {
-        this.hostName = hostName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
deleted file mode 100644
index 01b5d49..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "external_bigswitch_vns_devices")
-public class BigSwitchVnsDeviceVO implements InternalIdentity {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private long id;
-
-    @Column(name = "uuid")
-    private String uuid;
-
-    @Column(name = "host_id")
-    private long hostId;
-
-    @Column(name = "physical_network_id")
-    private long physicalNetworkId;
-
-    @Column(name = "provider_name")
-    private String providerName;
-
-    @Column(name = "device_name")
-    private String deviceName;
-
-    public BigSwitchVnsDeviceVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public BigSwitchVnsDeviceVO(long hostId, long physicalNetworkId, String providerName, String deviceName) {
-        super();
-        this.hostId = hostId;
-        this.physicalNetworkId = physicalNetworkId;
-        this.providerName = providerName;
-        this.deviceName = deviceName;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    public String getUuid() {
-        return uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    public long getPhysicalNetworkId() {
-        return physicalNetworkId;
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    public String getProviderName() {
-        return providerName;
-    }
-
-    public String getDeviceName() {
-        return deviceName;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
deleted file mode 100644
index f1866e2..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-public class AttachmentData {
-    private Attachment attachment;
-
-    public Attachment getAttachment() {
-        return attachment;
-    }
-
-    public AttachmentData() {
-        this.attachment = new Attachment();
-    }
-
-    public class Attachment {
-        private String id;
-        private String mac;
-
-        public String getId() {
-            return id;
-        }
-
-        public void setId(String id) {
-            this.id = id;
-        }
-
-        public String getMac() {
-            return mac;
-        }
-
-        public void setMac(String mac) {
-            this.mac = mac;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
deleted file mode 100644
index 4444599..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
+++ /dev/null
@@ -1,315 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.cookie.CookiePolicy;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
-import org.apache.log4j.Logger;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-
-public class BigSwitchVnsApi {
-    private static final Logger s_logger = Logger.getLogger(BigSwitchVnsApi.class);
-    private final static String s_protocol = "http";
-    private final static String s_nsBaseUri = "/networkService/v1.1";
-    private final static String CONTENT_TYPE = "Content-Type";
-    private final static String ACCEPT = "Accept";
-    private final static String CONTENT_JSON = "application/json";
-    private final static String HTTP_HEADER_INSTANCE_ID = "INSTANCE_ID";
-    private final static String CLOUDSTACK_INSTANCE_ID = "org.apache.cloudstack";
-    private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
-
-    private String _host;
-
-    private HttpClient _client;
-
-    /* This factory method is protected so we can extend this
-     * in the unittests.
-     */
-    protected HttpClient createHttpClient() {
-        return new HttpClient(s_httpClientManager);
-    }
-
-    protected HttpMethod createMethod(String type, String uri, int port) throws BigSwitchVnsApiException {
-        String url;
-        try {
-            url = new URL(s_protocol, _host, port, uri).toString();
-        } catch (MalformedURLException e) {
-            s_logger.error("Unable to build BigSwitch API URL", e);
-            throw new BigSwitchVnsApiException("Unable to build v API URL", e);
-        }
-
-        if ("post".equalsIgnoreCase(type)) {
-            return new PostMethod(url);
-        } else if ("get".equalsIgnoreCase(type)) {
-            return new GetMethod(url);
-        } else if ("delete".equalsIgnoreCase(type)) {
-            return new DeleteMethod(url);
-        } else if ("put".equalsIgnoreCase(type)) {
-            return new PutMethod(url);
-        } else {
-            throw new BigSwitchVnsApiException("Requesting unknown method type");
-        }
-    }
-
-    public BigSwitchVnsApi() {
-        _client = createHttpClient();
-        _client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
-    }
-
-    public void setControllerAddress(String address) {
-        this._host = address;
-    }
-
-    /**
-     * Logs into the BigSwitch API. The cookie is stored in the <code>_authcookie<code> variable.
-     * <p>
-     * The method returns false if the login failed or the connection could not be made.
-     *
-     */
-    protected void login() throws BigSwitchVnsApiException {
-        return;
-    }
-
-    public void createNetwork(NetworkData network) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + network.getNetwork().getTenantId() + "/networks";
-        executeCreateObject(network, new TypeToken<NetworkData>() {
-        }.getType(), uri, Collections.<String, String> emptyMap());
-    }
-
-    public void deleteNetwork(String tenantId, String networkId) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId;
-        executeDeleteObject(uri);
-    }
-
-    public void createPort(String networkUuid, PortData port) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + port.getPort().getTenantId() + "/networks/" + networkUuid + "/ports";
-        executeCreateObject(port, new TypeToken<PortData>() {
-        }.getType(), uri, Collections.<String, String> emptyMap());
-    }
-
-    public void modifyPort(String networkId, PortData port) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + port.getPort().getTenantId() + "/networks/" + networkId + "/ports";
-        executeUpdateObject(port, uri, Collections.<String, String> emptyMap());
-    }
-
-    public void deletePort(String tenantId, String networkId, String portId) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId;
-        executeDeleteObject(uri);
-    }
-
-    public void modifyPortAttachment(String tenantId, String networkId, String portId, AttachmentData attachment) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
-        executeUpdateObject(attachment, uri, Collections.<String, String> emptyMap());
-    }
-
-    public void deletePortAttachment(String tenantId, String networkId, String portId) throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
-        executeDeleteObject(uri);
-    }
-
-    public ControlClusterStatus getControlClusterStatus() throws BigSwitchVnsApiException {
-        String uri = s_nsBaseUri + "/health";
-        ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
-        }.getType(), uri, 80, null);
-        ccs.setStatus(true);
-
-        return ccs;
-    }
-
-    protected <T> void executeUpdateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchVnsApiException {
-        if (_host == null || _host.isEmpty()) {
-            throw new BigSwitchVnsApiException("Hostname is null or empty");
-        }
-
-        Gson gson = new Gson();
-
-        PutMethod pm = (PutMethod)createMethod("put", uri, 80);
-        pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
-        pm.setRequestHeader(ACCEPT, CONTENT_JSON);
-        pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
-        try {
-            pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), CONTENT_JSON, null));
-        } catch (UnsupportedEncodingException e) {
-            throw new BigSwitchVnsApiException("Failed to encode json request body", e);
-        }
-
-        executeMethod(pm);
-
-        if (pm.getStatusCode() != HttpStatus.SC_OK) {
-            String errorMessage = responseToErrorMessage(pm);
-            pm.releaseConnection();
-            s_logger.error("Failed to update object : " + errorMessage);
-            throw new BigSwitchVnsApiException("Failed to update object : " + errorMessage);
-        }
-        pm.releaseConnection();
-    }
-
-    protected <T> void executeCreateObject(T newObject, Type returnObjectType, String uri, Map<String, String> parameters) throws BigSwitchVnsApiException {
-        if (_host == null || _host.isEmpty()) {
-            throw new BigSwitchVnsApiException("Hostname is null or empty");
-        }
-
-        Gson gson = new Gson();
-
-        PostMethod pm = (PostMethod)createMethod("post", uri, 80);
-        pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
-        pm.setRequestHeader(ACCEPT, CONTENT_JSON);
-        pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
-        try {
-            pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), CONTENT_JSON, null));
-        } catch (UnsupportedEncodingException e) {
-            throw new BigSwitchVnsApiException("Failed to encode json request body", e);
-        }
-
-        executeMethod(pm);
-
-        if (pm.getStatusCode() != HttpStatus.SC_OK) {
-            String errorMessage = responseToErrorMessage(pm);
-            pm.releaseConnection();
-            s_logger.error("Failed to create object : " + errorMessage);
-            throw new BigSwitchVnsApiException("Failed to create object : " + errorMessage);
-        }
-        pm.releaseConnection();
-
-        return;
-    }
-
-    protected void executeDeleteObject(String uri) throws BigSwitchVnsApiException {
-        if (_host == null || _host.isEmpty()) {
-            throw new BigSwitchVnsApiException("Hostname is null or empty");
-        }
-
-        DeleteMethod dm = (DeleteMethod)createMethod("delete", uri, 80);
-        dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
-        dm.setRequestHeader(ACCEPT, CONTENT_JSON);
-        dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
-
-        executeMethod(dm);
-
-        if (dm.getStatusCode() != HttpStatus.SC_OK) {
-            String errorMessage = responseToErrorMessage(dm);
-            dm.releaseConnection();
-            s_logger.error("Failed to delete object : " + errorMessage);
-            throw new BigSwitchVnsApiException("Failed to delete object : " + errorMessage);
-        }
-        dm.releaseConnection();
-    }
-
-    @SuppressWarnings("unchecked")
-    protected <T> T executeRetrieveObject(Type returnObjectType, String uri, int port, Map<String, String> parameters) throws BigSwitchVnsApiException {
-        if (_host == null || _host.isEmpty()) {
-            throw new BigSwitchVnsApiException("Hostname is null or empty");
-        }
-
-        GetMethod gm = (GetMethod)createMethod("get", uri, port);
-        gm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
-        gm.setRequestHeader(ACCEPT, CONTENT_JSON);
-        gm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
-
-        if (parameters != null && !parameters.isEmpty()) {
-            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(parameters.size());
-            for (Entry<String, String> e : parameters.entrySet()) {
-                nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue()));
-            }
-            gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0]));
-        }
-
-        executeMethod(gm);
-
-        if (gm.getStatusCode() != HttpStatus.SC_OK) {
-            String errorMessage = responseToErrorMessage(gm);
-            gm.releaseConnection();
-            s_logger.error("Failed to retrieve object : " + errorMessage);
-            throw new BigSwitchVnsApiException("Failed to retrieve object : " + errorMessage);
-        }
-
-        Gson gson = new Gson();
-        T returnValue;
-        try {
-            returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(), returnObjectType);
-        } catch (IOException e) {
-            s_logger.error("IOException while retrieving response body", e);
-            throw new BigSwitchVnsApiException(e);
-        } finally {
-            gm.releaseConnection();
-        }
-        return returnValue;
-    }
-
-    protected void executeMethod(HttpMethodBase method) throws BigSwitchVnsApiException {
-        try {
-            _client.executeMethod(method);
-            if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
-                method.releaseConnection();
-                // login and try again
-                login();
-                _client.executeMethod(method);
-            }
-        } catch (HttpException e) {
-            s_logger.error("HttpException caught while trying to connect to the BigSwitch Controller", e);
-            method.releaseConnection();
-            throw new BigSwitchVnsApiException("API call to BigSwitch Controller Failed", e);
-        } catch (IOException e) {
-            s_logger.error("IOException caught while trying to connect to the BigSwitch Controller", e);
-            method.releaseConnection();
-            throw new BigSwitchVnsApiException("API call to BigSwitch Controller Failed", e);
-        }
-    }
-
-    private String responseToErrorMessage(HttpMethodBase method) {
-        assert method.isRequestSent() : "no use getting an error message unless the request is sent";
-
-        if ("text/html".equals(method.getResponseHeader(CONTENT_TYPE).getValue())) {
-            // The error message is the response content
-            // Safety margin of 1024 characters, anything longer is probably useless
-            // and will clutter the logs
-            try {
-                return method.getResponseBodyAsString(1024);
-            } catch (IOException e) {
-                s_logger.debug("Error while loading response body", e);
-            }
-        }
-
-        // The default
-        return method.getStatusText();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java
deleted file mode 100644
index d03dc7c..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-public class BigSwitchVnsApiException extends Exception {
-
-    private static final long serialVersionUID = -5864952230870945604L;
-
-    public BigSwitchVnsApiException() {
-    }
-
-    public BigSwitchVnsApiException(String message) {
-        super(message);
-    }
-
-    public BigSwitchVnsApiException(Throwable cause) {
-        super(cause);
-    }
-
-    public BigSwitchVnsApiException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
deleted file mode 100644
index 78ac023..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-public class ControlClusterStatus {
-    private boolean healthy;
-
-    public boolean getStatus() {
-        return healthy;
-    }
-
-    public void setStatus(boolean status) {
-        this.healthy = status;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
deleted file mode 100644
index e44c0f4..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-public class NetworkData {
-    private final Network network;
-
-    public Network getNetwork() {
-        return network;
-    }
-
-    public NetworkData() {
-        network = new Network();
-    }
-
-    public class Network {
-        private String id;
-        private String name;
-        private String tenantId;
-        private int vlan;
-        private String gateway;
-        private String state;
-
-        public String getUuid() {
-            return id;
-        }
-
-        public void setUuid(String id) {
-            this.id = id;
-        }
-
-        public String getDisplayName() {
-            return name;
-        }
-
-        public void setDisplay_name(String displayName) {
-            name = displayName;
-        }
-
-        public String getTenantId() {
-            return tenantId;
-        }
-
-        public void setTenantId(String tenantId) {
-            this.tenantId = tenantId;
-        }
-
-        public int getVlan() {
-            return vlan;
-        }
-
-        public void setVlan(int vlan) {
-            this.vlan = vlan;
-        }
-
-        public String getGateway() {
-            return gateway;
-        }
-
-        public void setGateway(String gateway) {
-            this.gateway = gateway;
-        }
-
-        public String getState() {
-            return state;
-        }
-
-        public void setState(String state) {
-            this.state = state;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
deleted file mode 100644
index d228d37..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.bigswitch;
-
-public class PortData {
-    private Port port;
-
-    public Port getPort() {
-        return this.port;
-    }
-
-    public PortData() {
-        this.port = new Port();
-    }
-
-    public class Port {
-        private String id;
-        private String name;
-        private String tenantId;
-        private String state;
-
-        public String getId() {
-            return id;
-        }
-
-        public void setId(String id) {
-            this.id = id;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public String getTenantId() {
-            return tenantId;
-        }
-
-        public void setTenantId(String tenantId) {
-            this.tenantId = tenantId;
-        }
-
-        public String getState() {
-            return state;
-        }
-
-        public void setState(String state) {
-            this.state = state;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java
deleted file mode 100644
index da4e003..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.List;
-
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface BigSwitchVnsDao extends GenericDao<BigSwitchVnsDeviceVO, Long> {
-    /**
-     * list all the bigswitch Vns devices added in to this physical network
-     * @param physicalNetworkId physical Network Id
-     * @return list of BigSwitchVnsDeviceVO for this physical network.
-     */
-    List<BigSwitchVnsDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java
deleted file mode 100644
index 0779ea2..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-@Local(value = BigSwitchVnsDao.class)
-public class BigSwitchVnsDaoImpl extends GenericDaoBase<BigSwitchVnsDeviceVO, Long> implements BigSwitchVnsDao {
-
-    protected final SearchBuilder<BigSwitchVnsDeviceVO> physicalNetworkIdSearch;
-
-    public BigSwitchVnsDaoImpl() {
-        physicalNetworkIdSearch = createSearchBuilder();
-        physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
-        physicalNetworkIdSearch.done();
-    }
-
-    @Override
-    public List<BigSwitchVnsDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
-        SearchCriteria<BigSwitchVnsDeviceVO> sc = physicalNetworkIdSearch.create();
-        sc.setParameters("physicalNetworkId", physicalNetworkId);
-        return search(sc, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
deleted file mode 100644
index c2b6032..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
+++ /dev/null
@@ -1,472 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.element;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.CreateVnsPortAnswer;
-import com.cloud.agent.api.CreateVnsPortCommand;
-import com.cloud.agent.api.DeleteVnsPortAnswer;
-import com.cloud.agent.api.DeleteVnsPortCommand;
-import com.cloud.agent.api.StartupBigSwitchVnsCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.api.ApiDBUtils;
-import com.cloud.api.commands.AddBigSwitchVnsDeviceCmd;
-import com.cloud.api.commands.DeleteBigSwitchVnsDeviceCmd;
-import com.cloud.api.commands.ListBigSwitchVnsDevicesCmd;
-import com.cloud.api.commands.VnsConstants;
-import com.cloud.api.response.BigSwitchVnsDeviceResponse;
-import com.cloud.configuration.ConfigurationManager;
-import com.cloud.dc.dao.VlanDao;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.host.DetailVO;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostDetailsDao;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.network.Network;
-import com.cloud.network.Network.Capability;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.network.NetworkModel;
-import com.cloud.network.Networks;
-import com.cloud.network.Networks.BroadcastDomainType;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.network.dao.BigSwitchVnsDao;
-import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkServiceMapDao;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.PhysicalNetworkDao;
-import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
-import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.network.resource.BigSwitchVnsResource;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ResourceStateAdapter;
-import com.cloud.resource.ServerResource;
-import com.cloud.resource.UnableDeleteHostException;
-import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionStatus;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachineProfile;
-
-@Component
-@Local(value = {NetworkElement.class, ConnectivityProvider.class})
-public class BigSwitchVnsElement extends AdapterBase implements BigSwitchVnsElementService, ConnectivityProvider, ResourceStateAdapter {
-    private static final Logger s_logger = Logger.getLogger(BigSwitchVnsElement.class);
-
-    private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
-
-    @Inject
-    ResourceManager _resourceMgr;
-    @Inject
-    PhysicalNetworkDao _physicalNetworkDao;
-    @Inject
-    PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
-    @Inject
-    BigSwitchVnsDao _bigswitchVnsDao;
-    @Inject
-    HostDetailsDao _hostDetailsDao;
-    @Inject
-    HostDao _hostDao;
-    @Inject
-    AgentManager _agentMgr;
-    @Inject
-    NetworkDao _networkDao;
-    @Inject
-    NetworkModel _networkModel;
-    @Inject
-    ConfigurationManager _configMgr;
-    @Inject
-    NetworkServiceMapDao _ntwkSrvcDao;
-    @Inject
-    VlanDao _vlanDao;
-
-    @Override
-    public Map<Service, Map<Capability, String>> getCapabilities() {
-        return capabilities;
-    }
-
-    @Override
-    public Provider getProvider() {
-        return VnsConstants.BigSwitchVns;
-    }
-
-    private boolean canHandle(Network network, Service service) {
-        s_logger.debug("Checking if BigSwitchVnsElement can handle service " + service.getName() + " on network " + network.getDisplayText());
-        if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) {
-            return false;
-        }
-
-        if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
-            s_logger.debug("BigSwitchVnsElement is not a provider for network " + network.getDisplayText());
-            return false;
-        }
-
-        if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, VnsConstants.BigSwitchVns)) {
-            s_logger.debug("BigSwitchVnsElement can't provide the " + service.getName() + " service on network " + network.getDisplayText());
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        super.configure(name, params);
-        _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
-        return true;
-    }
-
-    @Override
-    public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException, InsufficientCapacityException {
-        s_logger.debug("entering BigSwitchVnsElement implement function for network " + network.getDisplayText() + " (state " + network.getState() + ")");
-
-        return true;
-    }
-
-    @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
-
-        if (!canHandle(network, Service.Connectivity)) {
-            return false;
-        }
-
-        if (network.getBroadcastUri() == null) {
-            s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid");
-            return false;
-        }
-
-        String mac = nic.getMacAddress();
-        String tenantId = context.getDomain().getName();
-
-        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(network.getPhysicalNetworkId());
-        if (devices.isEmpty()) {
-            s_logger.error("No BigSwitch Controller on physical network " + network.getPhysicalNetworkId());
-            return false;
-        }
-        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
-        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
-
-        CreateVnsPortCommand cmd = new CreateVnsPortCommand(BroadcastDomainType.getValue(network.getBroadcastUri()), vm.getUuid(), tenantId, nic.getName(), mac);
-        CreateVnsPortAnswer answer = (CreateVnsPortAnswer)_agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
-
-        if (answer == null || !answer.getResult()) {
-            s_logger.error("CreatePortCommand failed");
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException {
-
-        if (!canHandle(network, Service.Connectivity)) {
-            return false;
-        }
-
-        if (network.getBroadcastUri() == null) {
-            s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid");
-            return false;
-        }
-
-        String tenantId = context.getDomain().getName();
-
-        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(network.getPhysicalNetworkId());
-        if (devices.isEmpty()) {
-            s_logger.error("No BigSwitch Controller on physical network " + network.getPhysicalNetworkId());
-            return false;
-        }
-        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
-        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
-
-        DeleteVnsPortCommand cmd = new DeleteVnsPortCommand(BroadcastDomainType.getValue(network.getBroadcastUri()), vm.getUuid(), tenantId);
-        DeleteVnsPortAnswer answer = (DeleteVnsPortAnswer)_agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
-
-        if (answer == null || !answer.getResult()) {
-            s_logger.error("DeletePortCommand failed");
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
-        if (!canHandle(network, Service.Connectivity)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
-        if (!canHandle(network, Service.Connectivity)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean isReady(PhysicalNetworkServiceProvider provider) {
-        return true;
-    }
-
-    @Override
-    public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException {
-        // Nothing to do here.
-        return true;
-    }
-
-    @Override
-    public boolean canEnableIndividualServices() {
-        return true;
-    }
-
-    @Override
-    public boolean verifyServicesCombination(Set<Service> services) {
-        if (!services.contains(Service.Connectivity)) {
-            s_logger.warn("Unable to provide services without Connectivity service enabled for this element");
-            return false;
-        }
-        return true;
-    }
-
-    private static Map<Service, Map<Capability, String>> setCapabilities() {
-        Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
-
-        // L2 Support : SDN provisioning
-        capabilities.put(Service.Connectivity, null);
-
-        return capabilities;
-    }
-
-    @Override
-    @DB
-    public BigSwitchVnsDeviceVO addBigSwitchVnsDevice(AddBigSwitchVnsDeviceCmd cmd) {
-        ServerResource resource = new BigSwitchVnsResource();
-        final String deviceName = VnsConstants.BigSwitchVns.getName();
-        NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName);
-        final Long physicalNetworkId = cmd.getPhysicalNetworkId();
-
-        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
-        if (physicalNetwork == null) {
-            throw new InvalidParameterValueException("Could not find phyical network with ID: " + physicalNetworkId);
-        }
-        long zoneId = physicalNetwork.getDataCenterId();
-
-        final PhysicalNetworkServiceProviderVO ntwkSvcProvider =
-            _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(), networkDevice.getNetworkServiceProvder());
-        if (ntwkSvcProvider == null) {
-            throw new CloudRuntimeException("Network Service Provider: " + networkDevice.getNetworkServiceProvder() + " is not enabled in the physical network: " +
-                physicalNetworkId + "to add this device");
-        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
-            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + " is in shutdown state in the physical network: " +
-                physicalNetworkId + "to add this device");
-        }
-
-        if (_bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
-            throw new CloudRuntimeException("A BigSwitch controller device is already configured on this physical network");
-        }
-
-        Map<String, String> params = new HashMap<String, String>();
-        params.put("guid", UUID.randomUUID().toString());
-        params.put("zoneId", String.valueOf(physicalNetwork.getDataCenterId()));
-        params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId()));
-        params.put("name", "BigSwitch Controller - " + cmd.getHost());
-        params.put("ip", cmd.getHost());
-        // FIXME What to do with multiple isolation types
-        params.put("transportzoneisotype", physicalNetwork.getIsolationMethods().get(0).toLowerCase());
-
-        Map<String, Object> hostdetails = new HashMap<String, Object>();
-        hostdetails.putAll(params);
-
-        try {
-            resource.configure(cmd.getHost(), hostdetails);
-
-            final Host host = _resourceMgr.addHost(zoneId, resource, Host.Type.L2Networking, params);
-            if (host != null) {
-                return Transaction.execute(new TransactionCallback<BigSwitchVnsDeviceVO>() {
-                    @Override
-                    public BigSwitchVnsDeviceVO doInTransaction(TransactionStatus status) {
-                        BigSwitchVnsDeviceVO bigswitchVnsDevice =
-                            new BigSwitchVnsDeviceVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(), deviceName);
-                        _bigswitchVnsDao.persist(bigswitchVnsDevice);
-
-                        DetailVO detail = new DetailVO(host.getId(), "bigswitchvnsdeviceid", String.valueOf(bigswitchVnsDevice.getId()));
-                        _hostDetailsDao.persist(detail);
-
-                        return bigswitchVnsDevice;
-                    }
-                });
-            } else {
-                throw new CloudRuntimeException("Failed to add BigSwitch Vns Device due to internal error.");
-            }
-        } catch (ConfigurationException e) {
-            throw new CloudRuntimeException(e.getMessage());
-        }
-    }
-
-    @Override
-    public BigSwitchVnsDeviceResponse createBigSwitchVnsDeviceResponse(BigSwitchVnsDeviceVO bigswitchVnsDeviceVO) {
-        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDeviceVO.getHostId());
-        _hostDao.loadDetails(bigswitchVnsHost);
-
-        BigSwitchVnsDeviceResponse response = new BigSwitchVnsDeviceResponse();
-        response.setDeviceName(bigswitchVnsDeviceVO.getDeviceName());
-        PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(bigswitchVnsDeviceVO.getPhysicalNetworkId());
-        if (pnw != null) {
-            response.setPhysicalNetworkId(pnw.getUuid());
-        }
-        response.setId(bigswitchVnsDeviceVO.getUuid());
-        response.setProviderName(bigswitchVnsDeviceVO.getProviderName());
-        response.setHostName(bigswitchVnsHost.getDetail("ip"));
-        response.setObjectName("bigswitchvnsdevice");
-        return response;
-    }
-
-    @Override
-    public boolean deleteBigSwitchVnsDevice(DeleteBigSwitchVnsDeviceCmd cmd) {
-        Long bigswitchVnsDeviceId = cmd.getBigSwitchVnsDeviceId();
-        BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao.findById(bigswitchVnsDeviceId);
-        if (bigswitchVnsDevice == null) {
-            throw new InvalidParameterValueException("Could not find a BigSwitch Controller with id " + bigswitchVnsDevice);
-        }
-
-        // Find the physical network we work for
-        Long physicalNetworkId = bigswitchVnsDevice.getPhysicalNetworkId();
-        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
-        if (physicalNetwork != null) {
-            List<NetworkVO> networkList = _networkDao.listByPhysicalNetwork(physicalNetworkId);
-
-            // Networks with broadcast type lswitch are ours
-            for (NetworkVO network : networkList) {
-                if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) {
-                    if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) {
-                        throw new CloudRuntimeException("This BigSwitch Controller device can not be deleted as there are one or more "
-                            + "logical networks provisioned by cloudstack.");
-                    }
-                }
-            }
-        }
-
-        HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
-        Long hostId = bigswitchHost.getId();
-
-        //bigswitchHost.setResourceState(ResourceState.Maintenance);
-        //_hostDao.update(hostId, bigswitchHost);
-        _hostDao.remove(hostId);
-        _resourceMgr.deleteHost(hostId, false, false);
-
-        _bigswitchVnsDao.remove(bigswitchVnsDeviceId);
-        return true;
-    }
-
-    @Override
-    public List<BigSwitchVnsDeviceVO> listBigSwitchVnsDevices(ListBigSwitchVnsDevicesCmd cmd) {
-        Long physicalNetworkId = cmd.getPhysicalNetworkId();
-        Long bigswitchVnsDeviceId = cmd.getBigSwitchVnsDeviceId();
-        List<BigSwitchVnsDeviceVO> responseList = new ArrayList<BigSwitchVnsDeviceVO>();
-
-        if (physicalNetworkId == null && bigswitchVnsDeviceId == null) {
-            throw new InvalidParameterValueException("Either physical network Id or bigswitch device Id must be specified");
-        }
-
-        if (bigswitchVnsDeviceId != null) {
-            BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao.findById(bigswitchVnsDeviceId);
-            if (bigswitchVnsDevice == null) {
-                throw new InvalidParameterValueException("Could not find BigSwitch controller with id: " + bigswitchVnsDevice);
-            }
-            responseList.add(bigswitchVnsDevice);
-        } else {
-            PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
-            if (physicalNetwork == null) {
-                throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
-            }
-            responseList = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
-        }
-
-        return responseList;
-    }
-
-    @Override
-    public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
-        if (!(startup[0] instanceof StartupBigSwitchVnsCommand)) {
-            return null;
-        }
-        host.setType(Host.Type.L2Networking);
-        return host;
-    }
-
-    @Override
-    public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException {
-        if (!(host.getType() == Host.Type.L2Networking)) {
-            return null;
-        }
-        return new DeleteHostAnswer(true);
-    }
-
-    @Override
-    public List<Class<?>> getCommands() {
-        List<Class<?>> cmdList = new ArrayList<Class<?>>();
-        cmdList.add(AddBigSwitchVnsDeviceCmd.class);
-        cmdList.add(DeleteBigSwitchVnsDeviceCmd.class);
-        cmdList.add(ListBigSwitchVnsDevicesCmd.class);
-        return cmdList;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java
deleted file mode 100644
index edcf6a1..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.element;
-
-import java.util.List;
-
-import com.cloud.api.commands.AddBigSwitchVnsDeviceCmd;
-import com.cloud.api.commands.DeleteBigSwitchVnsDeviceCmd;
-import com.cloud.api.commands.ListBigSwitchVnsDevicesCmd;
-import com.cloud.api.response.BigSwitchVnsDeviceResponse;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.utils.component.PluggableService;
-
-public interface BigSwitchVnsElementService extends PluggableService {
-
-    public BigSwitchVnsDeviceVO addBigSwitchVnsDevice(AddBigSwitchVnsDeviceCmd cmd);
-
-    public BigSwitchVnsDeviceResponse createBigSwitchVnsDeviceResponse(BigSwitchVnsDeviceVO bigswitchDeviceVO);
-
-    boolean deleteBigSwitchVnsDevice(DeleteBigSwitchVnsDeviceCmd cmd);
-
-    List<BigSwitchVnsDeviceVO> listBigSwitchVnsDevices(ListBigSwitchVnsDevicesCmd cmd);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
deleted file mode 100644
index cff7585..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.cloud.network.guru;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.CreateVnsNetworkAnswer;
-import com.cloud.agent.api.CreateVnsNetworkCommand;
-import com.cloud.agent.api.DeleteVnsNetworkCommand;
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostDetailsDao;
-import com.cloud.network.BigSwitchVnsDeviceVO;
-import com.cloud.network.Network;
-import com.cloud.network.Network.GuestType;
-import com.cloud.network.Network.State;
-import com.cloud.network.NetworkProfile;
-import com.cloud.network.Networks.BroadcastDomainType;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetwork.IsolationMethod;
-import com.cloud.network.dao.BigSwitchVnsDao;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.PhysicalNetworkDao;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.resource.ResourceManager;
-import com.cloud.user.Account;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachineProfile;
-
-@Local(value = NetworkGuru.class)
-public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
-    private static final Logger s_logger = Logger.getLogger(BigSwitchVnsGuestNetworkGuru.class);
-
-    @Inject
-    DataCenterDao _zoneDao;
-    @Inject
-    PhysicalNetworkDao _physicalNetworkDao;
-    @Inject
-    AccountDao _accountDao;
-    @Inject
-    BigSwitchVnsDao _bigswitchVnsDao;
-    @Inject
-    HostDao _hostDao;
-    @Inject
-    ResourceManager _resourceMgr;
-    @Inject
-    AgentManager _agentMgr;
-    @Inject
-    HostDetailsDao _hostDetailsDao;
-
-    public BigSwitchVnsGuestNetworkGuru() {
-        super();
-        _isolationMethods = new IsolationMethod[] {IsolationMethod.VNS};
-    }
-
-    @Override
-    protected boolean canHandle(NetworkOffering offering, NetworkType networkType, PhysicalNetwork physicalNetwork) {
-        if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == Network.GuestType.Isolated &&
-            isMyIsolationMethod(physicalNetwork)) {
-            return true;
-        } else {
-            s_logger.trace("We only take care of Guest networks of type   " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
-            return false;
-        }
-    }
-
-    @Override
-    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
-        // Check of the isolation type of the related physical network is VNS
-        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
-        if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("VNS")) {
-            s_logger.debug("Refusing to design this network, the physical isolation type is not VNS");
-            return null;
-        }
-
-        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physnet.getId());
-        if (devices.isEmpty()) {
-            s_logger.error("No BigSwitxh Controller on physical network " + physnet.getName());
-            return null;
-        }
-        s_logger.debug("BigSwitch Controller " + devices.get(0).getUuid() + " found on physical network " + physnet.getId());
-
-        s_logger.debug("Physical isolation type is VNS, asking GuestNetworkGuru to design this network");
-        NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner);
-        if (networkObject == null) {
-            return null;
-        }
-        // Override the broadcast domain type
-        networkObject.setBroadcastDomainType(BroadcastDomainType.Lswitch);
-
-        return networkObject;
-    }
-
-    @Override
-    public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException {
-        assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
-
-        long dcId = dest.getDataCenter().getId();
-
-        //get physical network id
-        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
-
-        NetworkVO implemented =
-            new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
-                network.getDataCenterId(), physicalNetworkId, offering.getRedundantRouter());
-
-        if (network.getGateway() != null) {
-            implemented.setGateway(network.getGateway());
-        }
-
-        if (network.getCidr() != null) {
-            implemented.setCidr(network.getCidr());
-        }
-
-        String vnet =
-            _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), context.getReservationId(), UseSystemGuestVlans.valueIn(network.getAccountId()));
-        if (vnet == null) {
-            throw new InsufficientVirtualNetworkCapacityException("Unable to allocate vnet as a " + "part of network " + network + " implement ", DataCenter.class, dcId);
-        }
-        // when supporting more types of networks this need to become
-//        int vlan = Integer.parseInt(BroadcastDomainType.getValue(vnet));
-        int vlan = Integer.parseInt(vnet);
-
-        // Name is either the given name or the uuid
-        String name = network.getName();
-        String networkUuid = implemented.getUuid();
-        if (name == null || name.isEmpty()) {
-            name = ((NetworkVO)network).getUuid();
-        }
-        if (name.length() > 64) {
-            name = name.substring(0, 63); // max length 64
-        }
-
-        String tenantId = context.getDomain().getName();
-        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
-        if (devices.isEmpty()) {
-            s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
-            return null;
-        }
-        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
-        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
-        _hostDao.loadDetails(bigswitchVnsHost);
-
-        CreateVnsNetworkCommand cmd = new CreateVnsNetworkCommand(networkUuid, name, tenantId, vlan);
-        CreateVnsNetworkAnswer answer = (CreateVnsNetworkAnswer)_agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
-
-        if (answer == null || !answer.getResult()) {
-            s_logger.error("CreateNetworkCommand failed");
-            return null;
-        }
-
-        try {
-            implemented.setBroadcastUri(new URI("vns", cmd.getNetworkUuid(), null));
-            implemented.setBroadcastDomainType(BroadcastDomainType.Lswitch);
-            s_logger.info("Implemented OK, network " + networkUuid + " in tenant " + tenantId + " linked to " + implemented.getBroadcastUri().toString());
-        } catch (URISyntaxException e) {
-            s_logger.error("Unable to store network id in broadcast uri, uuid = " + implemented.getUuid(), e);
-        }
-
-        return implemented;
-    }
-
-    @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        super.reserve(nic, network, vm, dest, context);
-    }
-
-    @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
-        // TODO Auto-generated method stub
-        return super.release(nic, vm, reservationId);
-    }
-
-    @Override
-    public void shutdown(NetworkProfile profile, NetworkOffering offering) {
-        NetworkVO networkObject = _networkDao.findById(profile.getId());
-        if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch || networkObject.getBroadcastUri() == null) {
-            s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
-            return;
-        }
-
-        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
-        if (devices.isEmpty()) {
-            s_logger.error("No BigSwitch Controller on physical network " + networkObject.getPhysicalNetworkId());
-            return;
-        }
-        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
-        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
-
-        String tenantId = profile.getNetworkDomain();
-
-        DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId, BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
-        _agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
-
-        super.shutdown(profile, offering);
-    }
-
-    @Override
-    public boolean trash(Network network, NetworkOffering offering) {
-        return super.trash(network, offering);
-    }
-}


[42/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Merge branch '8380' of https://github.com/gauravaradhye/cloudstack
This closes #159


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bb4f234f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bb4f234f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bb4f234f

Branch: refs/heads/reporter
Commit: bb4f234f9d32ab4178c5685d389cbc943f139e4b
Parents: 0ada08a 469270a
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Tue Apr 14 11:30:10 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Apr 14 11:30:10 2015 +0530

----------------------------------------------------------------------
 setup/dev/advanced.cfg                  |  6 ++++
 tools/marvin/marvin/testSetupSuccess.py | 46 ++++++++++++++++++++++------
 2 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[32/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-7593: in 450to451 upgrade path copy vm_details from template for vmware

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 8e1507078052b8068b828d336f8d0358915047e1)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a70947f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a70947f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a70947f9

Branch: refs/heads/reporter
Commit: a70947f9b1a1e57ed79d082fae29061574df2a20
Parents: a07497b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:34:27 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:59 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade450to451.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a70947f9/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
index 89fe5ec..218f4ec 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
@@ -74,6 +74,7 @@ public class Upgrade450to451 implements DbUpgrade {
         encryptKeyInKeyStore(conn);
         encryptIpSecPresharedKeysOfRemoteAccessVpn(conn);
         encryptStoragePoolUserInfo(conn);
+        updateUserVmDetailsWithNicAdapterType(conn);
     }
 
     private void encryptKeyInKeyStore(Connection conn) {
@@ -175,4 +176,21 @@ public class Upgrade450to451 implements DbUpgrade {
         }
         s_logger.debug("Done encrypting storage_pool's user_info column");
     }
+
+    private void updateUserVmDetailsWithNicAdapterType(Connection conn) {
+        PreparedStatement insertPstmt = null;
+        try {
+            insertPstmt = conn.prepareStatement("INSERT INTO `cloud`.`user_vm_details`(vm_id,name,value,display) select v.id as vm_id, details.name, details.value, details.display from `cloud`.`vm_instance` as v, `cloud`.`vm_template_details` as details  where v.removed is null and v.vm_template_id=details.template_id and details.name='nicAdapter' and details.template_id in (select id from `cloud`.`vm_template` where hypervisor_type = 'vmware') and v.id not in (select vm_id from `cloud`.`user_vm_details` where name='nicAdapter');");
+            insertPstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Failed to update user_vm_details table with nicAdapter entries by copying from vm_template_detail table", e);
+        } finally {
+            try {
+                if (insertPstmt != null)
+                    insertPstmt.close();
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done. Updated user_vm_details table with nicAdapter entries by copying from vm_template_detail table. This affects only VM/templates with hypervisor_type as VMware.");
+    }
 }


[09/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
make sure sync cannot block reboot

The recent discussed improvement has the risk that if 'sync' hangs, the reboot may be delayed in the same way as the 'reboot' command would do. To work around, we're adding a 5 second timeout. If it cannot sync in 5 seconds, it will not succeed anyway and we should proceed the reset.

@snuf: Could we use your OVM3 heartbeat script for other hypervisors as well? One way to do it seems like a nice idea :-)

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7bce656b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7bce656b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7bce656b

Branch: refs/heads/reporter
Commit: 7bce656b409f6bc0e18fe963cfeb9c2134b095be
Parents: 770297e
Author: Remi Bergsma <gi...@remi.nl>
Authored: Thu Apr 9 12:18:21 2015 +0200
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Thu Apr 9 12:18:21 2015 +0200

----------------------------------------------------------------------
 scripts/vm/hypervisor/kvm/kvmheartbeat.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bce656b/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/kvm/kvmheartbeat.sh b/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
index ff6fd0a..7c8ee67 100755
--- a/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
+++ b/scripts/vm/hypervisor/kvm/kvmheartbeat.sh
@@ -156,7 +156,8 @@ then
 elif [ "$cflag" == "1" ]
 then
   /usr/bin/logger -t heartbeat "kvmheartbeat.sh rebooted system because it was unable to write the heartbeat to the storage."
-  sync
+  sync &
+  sleep 5
   echo b > /proc/sysrq-trigger
   exit $?
 else


[36/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8380: Adding script to testSetupSuccess.py to check VCenter port groups are created for storage, management and public traffic as soon as zone is deployed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/469270ab
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/469270ab
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/469270ab

Branch: refs/heads/reporter
Commit: 469270ab0c6ee2df4d1ece0aa2b8d68fd281cd9a
Parents: ccf13ec
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Apr 13 16:50:38 2015 +0530
Committer: Gaurav Aradhye <ga...@clogeny.com>
Committed: Mon Apr 13 16:50:38 2015 +0530

----------------------------------------------------------------------
 setup/dev/advanced.cfg                  |  6 ++++
 tools/marvin/marvin/testSetupSuccess.py | 46 ++++++++++++++++++++++------
 2 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469270ab/setup/dev/advanced.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg
index 18dee31..53a8221 100644
--- a/setup/dev/advanced.cfg
+++ b/setup/dev/advanced.cfg
@@ -55,6 +55,12 @@
                     ]
                 }
             ],
+            "vmwaredc": {
+                "username": "",
+                "vcenter": "",
+                "password": "",
+                "name": ""
+            },
             "ipranges": [
                 {
                     "startip": "192.168.2.2",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/469270ab/tools/marvin/marvin/testSetupSuccess.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/testSetupSuccess.py b/tools/marvin/marvin/testSetupSuccess.py
index 8b000f9..c79ecda 100644
--- a/tools/marvin/marvin/testSetupSuccess.py
+++ b/tools/marvin/marvin/testSetupSuccess.py
@@ -15,10 +15,15 @@
 # specific language governing permissions and limitations
 # under the License.
 
-import marvin
-import unittest
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import listSystemVms, listZones, listTemplates
+from marvin.lib.vcenter import Vcenter
+from marvin.lib.common import verifyVCenterPortGroups
+from marvin.codes import (PUBLIC_TRAFFIC,
+                          MANAGEMENT_TRAFFIC,
+                          STORAGE_TRAFFIC,
+                          PASS,
+                          VMWAREDVS)
 from time import sleep as delay
 
 
@@ -33,10 +38,11 @@ class TestSetupSuccess(cloudstackTestCase):
     def setUpClass(cls):
         testClient = super(TestSetupSuccess, cls).getClsTestClient()
         cls.apiClient = testClient.getApiClient()
+        cls.hypervisor = testClient.getHypervisorInfo()
 
         zones = listZones.listZonesCmd()
         cls.zones_list = cls.apiClient.listZones(zones)
-        cls.retry = 2
+        cls.retry = 50
 
     def test_systemVmReady(self):
         """
@@ -89,10 +95,32 @@ class TestSetupSuccess(cloudstackTestCase):
                                 "builtIn templates not ready in zone %s" %
                                 z.name)
 
-    def test_deployVmWithBuiltIn(self):
-        """
-        Deploys a VM with the built-in CentOS template
-        """
+    def test_VCenterPorts(self):
+        """  Test if correct VCenter ports are created for all traffic types """
+
+        if self.hypervisor.lower() != "vmware":
+            self.skipTest("This test is intended only for vmware")
+
+        zoneDict = {}
+        for zone in self.config.zones:
+            zoneDict[zone.name] = zone.vmwaredc
+
+        for zone in self.zones_list:
+            vmwaredc = zoneDict[zone.name]
+            vcenterObj = Vcenter(
+                vmwaredc.vcenter,
+                vmwaredc.username,
+                vmwaredc.password)
+            response = verifyVCenterPortGroups(
+                self.apiClient,
+                vcenterObj,
+                traffic_types_to_validate=[
+                    PUBLIC_TRAFFIC,
+                    MANAGEMENT_TRAFFIC,
+                    STORAGE_TRAFFIC],
+                zoneid=zone.id,
+                switchTypes=[VMWAREDVS])
+            self.assertEqual(response[0], PASS, response[1])
 
     @classmethod
     def tearDownClass(cls):


[13/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Move Devcloud4 into main repository


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/66cded75
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/66cded75
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/66cded75

Branch: refs/heads/reporter
Commit: 66cded75e0f512b431d27cea2cffbc45deb3d859
Parents: da233c7
Author: Ian Duffy <ia...@ianduffy.ie>
Authored: Sat Apr 11 16:17:02 2015 +0100
Committer: Ian Duffy <ia...@ianduffy.ie>
Committed: Sat Apr 11 16:17:02 2015 +0100

----------------------------------------------------------------------
 tools/devcloud4/.gitignore                      |   4 +
 tools/devcloud4/README.md                       | 101 +++++++
 tools/devcloud4/advanced/Berksfile              |  27 ++
 tools/devcloud4/advanced/README.md              |  95 ++++++
 tools/devcloud4/advanced/Vagrantfile            | 115 ++++++++
 .../devcloud4/advanced/chef_configuration.json  |  24 ++
 tools/devcloud4/advanced/marvin.cfg             | 124 ++++++++
 tools/devcloud4/basic/Berksfile                 |  27 ++
 tools/devcloud4/basic/README.md                 |  83 ++++++
 tools/devcloud4/basic/Vagrantfile               |  81 ++++++
 tools/devcloud4/basic/chef_configuration.json   |  22 ++
 tools/devcloud4/basic/marvin.cfg                | 110 +++++++
 .../binary-installation-advanced/Berksfile      |  26 ++
 .../binary-installation-advanced/Vagrantfile    | 119 ++++++++
 .../chef_configuration.json                     |  37 +++
 .../binary-installation-advanced/marvin.cfg.erb | 123 ++++++++
 .../binary-installation-basic/Berksfile         |  26 ++
 .../binary-installation-basic/Vagrantfile       |  83 ++++++
 .../chef_configuration.json                     |  34 +++
 .../binary-installation-basic/marvin.cfg.erb    | 109 +++++++
 .../common/binary-installation/README.md        |   0
 .../attributes/database_server.rb               |  22 ++
 .../binary-installation/attributes/default.rb   |  38 +++
 .../common/binary-installation/metadata.rb      |  42 +++
 .../recipes/database_server.rb                  |  24 ++
 .../binary-installation/recipes/default.rb      |  27 ++
 .../recipes/management_server.rb                |  57 ++++
 .../binary-installation/recipes/nfsshares.rb    |  48 ++++
 tools/devcloud4/common/configure-network.sh     |  37 +++
 .../common/development-installation/README.md   |   0
 .../attributes/database_server.rb               |  22 ++
 .../attributes/default.rb                       |  29 ++
 .../files/default/cloud-install-sys-tmplt       | 288 +++++++++++++++++++
 .../files/default/createtmplt.sh                | 239 +++++++++++++++
 .../common/development-installation/metadata.rb |  42 +++
 .../recipes/database_server.rb                  |  24 ++
 .../development-installation/recipes/default.rb |  27 ++
 .../recipes/nfsshares.rb                        |  48 ++++
 .../recipes/system_templates.rb                 |  38 +++
 tools/devcloud4/pom.xml                         | 112 ++++++++
 tools/devcloud4/prefill.sql                     |  34 +++
 tools/pom.xml                                   |   3 +-
 42 files changed, 2570 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/.gitignore
----------------------------------------------------------------------
diff --git a/tools/devcloud4/.gitignore b/tools/devcloud4/.gitignore
new file mode 100644
index 0000000..3969b1b
--- /dev/null
+++ b/tools/devcloud4/.gitignore
@@ -0,0 +1,4 @@
+tmp
+cookbooks
+*.lock
+.vagrant
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/README.md
----------------------------------------------------------------------
diff --git a/tools/devcloud4/README.md b/tools/devcloud4/README.md
new file mode 100644
index 0000000..00d6756
--- /dev/null
+++ b/tools/devcloud4/README.md
@@ -0,0 +1,101 @@
+# Devcloud 4
+
+## Introduction
+
+The follow project aims to simplify getting a full Apache CloudStack environment running on your machine. You can either take the easy ride and run `vagrant up` in either one of the 'binary installation' directories or compile CloudStack yourself. See for instructions in the 'basic' and 'advanced' directories.
+
+The included VagrantFile will give you:
+
+ - Management
+     - NFS Server
+     - MySQL Server
+     - Router
+     - * Cloudstack Management Server * (Only given in binary installation)
+
+ - XenServer 6.2
+
+## Getting started
+
+1. Due to the large amount of data to be pulled from the Internet, it's probably not a good idea to do this over WiFi or Mobile data.
+
+1. Given the amount of virtual machines this brings up it is recommended you have atleast 8gb of ram before attempting this.
+
+1. Ensure your system has `git` installed.
+
+1. When on Windows, make sure you've set the git option `autocrlf` to `false`:
+
+      ```
+      git config --global core.autocrlf false
+      ```
+
+1. Clone the repository:
+
+	```
+	git clone https://github.com/imduffy15/devcloud4.git
+	```
+
+1. Download and Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
+   
+   On Windows7, the Xenserver VM crashed immediately after booting with a General Protection Fault. 
+   Installing VirtualBox version 4.3.6r91406 (https://www.virtualbox.org/wiki/Download_Old_Builds_4_3) fixed the problem, but only downgrade if the latest version does not work for you.
+ 
+1. Download and install [Vagrant](https://www.vagrantup.com/downloads.html)
+
+1. Ensure all Vagrant Plugins are installed:
+
+	```bash
+	vagrant plugin install vagrant-berkshelf vagrant-omnibus
+	```
+
+1. Download and install [ChefDK](https://downloads.chef.io/chef-dk/)
+
+### Configure virtualbox
+
+1. Open virtualbox and navigate to its preferences/settings window. 
+
+1. Click onto the network tab and then onto the host only network tab. 
+
+1. Configure your adapters as follows:
+
+   - On Windows, the adapternames are different, and map as follows:
+     - vboxnet0: VirtualBox Host-Only Ethernet Adapter
+     - vboxnet1: VirtualBox Host-Only Ethernet Adapter 2
+     - vboxnet2: VirtualBox Host-Only Ethernet Adapter 3
+    
+    #### For Basic Networking you only need:
+
+    ##### vboxnet0
+    - IPv4 IP address of 192.168.22.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+    #### For Advanced Networking you will need:
+    
+    
+    
+    ##### vboxnet1
+    - IPv4 IP address of 192.168.23.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+    
+    
+    ##### vboxnet2
+    - IPv4 IP address of 192.168.24.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+
+## Defaults
+
+### Management Server
+
+ - IP: 192.168.22.5
+ - Username: vagrant or root
+ - Password: vagrant
+
+### Hypervisor
+
+ - IP: 192.168.22.10
+ - Username: root
+ - Password: password
+    

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/advanced/Berksfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/advanced/Berksfile b/tools/devcloud4/advanced/Berksfile
new file mode 100644
index 0000000..616ca68
--- /dev/null
+++ b/tools/devcloud4/advanced/Berksfile
@@ -0,0 +1,27 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+source "https://api.berkshelf.com"
+
+cookbook 'hostname'
+cookbook 'selinux'
+cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
+cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
+cookbook 'development-installation', path: '../common/development-installation'
+cookbook 'python', git: 'https://github.com/imduffy15/python.git'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/advanced/README.md
----------------------------------------------------------------------
diff --git a/tools/devcloud4/advanced/README.md b/tools/devcloud4/advanced/README.md
new file mode 100644
index 0000000..6171839
--- /dev/null
+++ b/tools/devcloud4/advanced/README.md
@@ -0,0 +1,95 @@
+### Configure virtualbox
+
+1. Open virtualbox and navigate to its preferences/settings window. 
+
+1. Click onto the network tab and then onto the host only network tab. 
+
+1. Configure your adapters as follows:
+
+    ##### vboxnet0
+    - IPv4 IP address of 192.168.22.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+    ##### vboxnet1
+    - IPv4 IP address of 192.168.23.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+    ##### vboxnet2
+    - IPv4 IP address of 192.168.24.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+   
+### Start the vagrant boxes
+
+```bash
+vagrant up
+```
+
+*** Common issues: ***
+
+- 'Cannot forward the specified ports on this VM': There could be MySQL or some other
+  service running on the host OS causing vagrant to fail setting up local port forwarding.
+
+
+### Start Cloudstack
+
+1. Clone the Cloudstack Repository:
+
+	```
+	git clone https://github.com/apache/cloudstack.git
+	```
+
+	*** Note: ***
+	
+	Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same:	
+
+	```
+	git reset --hard 0810029
+	```
+
+1. Download vhd-util:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/
+	chmod +x scripts/vm/hypervisor/xenserver/vhd-util
+	```
+
+1. Compile Cloudstack:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -P developer,systemvm clean install -DskipTests=true
+	```
+	
+1. Deploy Cloudstack Database:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb
+	```
+
+1. Start Cloudstack:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -pl :cloud-client-ui jetty:run
+	```
+
+1. Install Marvin:
+
+	```
+	cd /path/to/cloudstack/repo
+	pip install tools/marvin/dist/Marvin-0.1.0.tar.gz
+	```
+
+1. Deploy:
+
+    ```
+    python -m marvin.deployDataCenter -i marvin.cfg 
+    ```
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/advanced/Vagrantfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/advanced/Vagrantfile b/tools/devcloud4/advanced/Vagrantfile
new file mode 100644
index 0000000..0bf843b
--- /dev/null
+++ b/tools/devcloud4/advanced/Vagrantfile
@@ -0,0 +1,115 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+VAGRANTFILE_API_VERSION = '2'
+
+Vagrant.require_version '>= 1.5.0'
+
+unless Vagrant.has_plugin?('vagrant-berkshelf')
+  raise 'vagrant-berkshelf is not installed!'
+end
+
+unless Vagrant.has_plugin?('vagrant-omnibus')
+  raise 'vagrant-omnibus is not installed!'
+end
+
+xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  config.vm.define 'xenserver' do |xenserver|
+    xenserver.vm.box = 'duffy/xenserver'
+
+    # Public Network (IP address is ignored.)
+    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10'
+
+    # Guest Network (IP address is ignored.)
+    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10'
+
+    # Configure Interfaces
+
+    ## Configure Management Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
+    end
+
+    ## Configure Public Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth2 na na PUBLIC)
+    end
+
+    ## Configure Guest Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth3 na na GUEST)
+    end
+
+    ## Tweak kernel
+    xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf"
+
+    ## Map host only networks and the adapters
+    xenserver.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
+      v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
+      v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
+      v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1']
+      v.customize ['modifyvm', :id, '--hostonlyadapter4', 'vboxnet2']
+      v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
+      v.customize ["modifyvm", :id, '--nictype3', 'Am79C973']
+      v.customize ["modifyvm", :id, '--nictype4', 'Am79C973']
+    end
+  end
+
+  config.vm.define 'management' do |management|
+    management.vm.box = 'chef/centos-6.5'
+
+    # Configure management interface
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
+
+    # Configure public interface
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5'
+
+    # Port forward MySQL
+    management.vm.network 'forwarded_port', guest: 3306, host: 3306
+
+    management.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--memory', 512]
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
+      v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1']
+      v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
+      v.customize ["modifyvm", :id, '--nictype3', 'Am79C973']
+    end
+
+    management.omnibus.chef_version = "11.16.4" 
+    management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
+    management.berkshelf.enabled = true
+
+    CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
+
+    management.vm.provision 'chef_solo' do |chef|
+      chef.run_list = CHEF_CONFIGURATION.delete('run_list')
+      chef.json = CHEF_CONFIGURATION
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/advanced/chef_configuration.json
----------------------------------------------------------------------
diff --git a/tools/devcloud4/advanced/chef_configuration.json b/tools/devcloud4/advanced/chef_configuration.json
new file mode 100644
index 0000000..40d5bce
--- /dev/null
+++ b/tools/devcloud4/advanced/chef_configuration.json
@@ -0,0 +1,24 @@
+{
+  "run_list": [
+    "recipe[development-installation]",
+    "recipe[nat-router]"
+  ],
+  "iptables": {
+    "lans": ["eth1", "eth2"]
+  },
+  "set_fqdn": "*.localdomain",
+  "selinux": {
+      "state": "permissive"
+  },
+  "cloudstack": {
+      "secondary": {
+        "path": "/exports/secondary"
+      },
+      "primary": {
+        "path": "/exports/primary"
+      },
+      "hypervisor_tpl": {
+        "xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2"
+      }
+  }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/advanced/marvin.cfg
----------------------------------------------------------------------
diff --git a/tools/devcloud4/advanced/marvin.cfg b/tools/devcloud4/advanced/marvin.cfg
new file mode 100644
index 0000000..9e2ac56
--- /dev/null
+++ b/tools/devcloud4/advanced/marvin.cfg
@@ -0,0 +1,124 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+{
+    "zones": [
+        {
+            "name": "DevCloud-Advanced-01",
+            "guestcidraddress": "10.1.1.0/24",
+            "localstorageenabled": true,
+            "dns1": "8.8.8.8",
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone",
+                    "vlan": "100-200",
+                    "name": "DevCloud-Network-01",
+                    "traffictypes": [
+                        {
+                            "xen": "GUEST",
+                            "typ": "Guest"
+                        },
+                        {
+                            "xen": "MGMT",
+                            "typ": "Management"
+                        },
+                        {
+                            "xen": "PUBLIC",
+                            "typ": "Public"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VpcVirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "InternalLbVm"
+                        }
+                    ],
+                    "isolationmethods": [
+                        "VLAN"
+                    ]
+                }
+            ],
+            "ipranges": [
+                {
+                    "startip": "192.168.23.100",
+                    "endip": "192.168.23.120",
+                    "netmask": "255.255.255.0",
+                    "vlan": "untagged",
+                    "gateway": "192.168.23.5"
+                }
+            ],
+            "networktype": "Advanced",
+            "pods": [
+                {
+                    "startip": "192.168.22.100",
+                    "endip": "192.168.22.120",
+                    "name": "DevCloud-POD-01",
+                    "netmask": "255.255.255.0",
+                    "clusters": [
+                        {
+                            "clustername": "DevCloud-CLUSTER-01",
+                            "hypervisor": "XenServer",
+                            "hosts": [
+                                {
+                                    "username": "root",
+                                    "url": "http://192.168.22.10/",
+                                    "password": "password"
+                                }
+                            ],
+                            "clustertype": "CloudManaged"
+                        }
+                    ],
+                    "gateway": "192.168.22.5"
+                }
+            ],
+            "internaldns1": "8.8.8.8",
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.22.5/exports/secondary",
+                    "provider": "NFS",
+                    "details": [ ]
+                }
+            ]
+        }
+    ],
+    "logger": {
+        "LogFolderPath": "/tmp/"
+    },
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "192.168.22.1",
+            "port": 8096
+        }
+    ],
+    "dbSvr": {
+        "dbSvr": "127.0.0.1",
+        "port": 3306,
+        "user": "cloud",
+        "passwd": "cloud",
+        "db": "cloud"
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/basic/Berksfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/basic/Berksfile b/tools/devcloud4/basic/Berksfile
new file mode 100644
index 0000000..616ca68
--- /dev/null
+++ b/tools/devcloud4/basic/Berksfile
@@ -0,0 +1,27 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+source "https://api.berkshelf.com"
+
+cookbook 'hostname'
+cookbook 'selinux'
+cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
+cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
+cookbook 'development-installation', path: '../common/development-installation'
+cookbook 'python', git: 'https://github.com/imduffy15/python.git'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/basic/README.md
----------------------------------------------------------------------
diff --git a/tools/devcloud4/basic/README.md b/tools/devcloud4/basic/README.md
new file mode 100644
index 0000000..31cb62d
--- /dev/null
+++ b/tools/devcloud4/basic/README.md
@@ -0,0 +1,83 @@
+### Configure virtualbox
+
+1. Open virtualbox and navigate to its preferences/settings window. 
+
+1. Click onto the network tab and then onto the host only network tab. 
+
+1. Configure your adapters as follows:
+
+    ##### vboxnet0
+    - IPv4 IP address of 192.168.22.1
+    - Subnet of 255.255.255.0
+    - DHCP server disabled
+    
+
+### Start the vagrant boxes
+
+```bash
+vagrant up
+```
+
+*** Common issues: ***
+
+- 'Cannot forward the specified ports on this VM': There could be MySQL or some other
+  service running on the host OS causing vagrant to fail setting up local port forwarding.
+
+
+### Start Cloudstack
+
+1. Clone the Cloudstack Repository:
+
+	```
+	git clone https://github.com/apache/cloudstack.git
+	```
+
+	*** Note: ***
+	
+	Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same:	
+
+	```
+	git reset --hard 0810029
+	```
+
+1. Download vhd-util:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/
+	chmod +x scripts/vm/hypervisor/xenserver/vhd-util
+	```
+
+1. Compile Cloudstack:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -P developer,systemvm clean install -DskipTests=true
+	```
+	
+1. Deploy Cloudstack Database:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb
+	```
+
+1. Start Cloudstack:
+
+	```bash
+	cd /path/to/cloudstack/repo
+	mvn -pl :cloud-client-ui jetty:run
+	```
+
+1. Install Marvin:
+
+	```
+	cd /path/to/cloudstack/repo
+	pip install tools/marvin/dist/Marvin-4.6.0-SNAPSHOT.tar.gz --allow-external mysql-connector-python
+	```
+
+1. Deploying:
+
+    ```
+    python -m marvin.deployDataCenter -i marvin.cfg 
+    ```

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/basic/Vagrantfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/basic/Vagrantfile b/tools/devcloud4/basic/Vagrantfile
new file mode 100644
index 0000000..5f22edc
--- /dev/null
+++ b/tools/devcloud4/basic/Vagrantfile
@@ -0,0 +1,81 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+VAGRANTFILE_API_VERSION = '2'
+
+Vagrant.require_version '>= 1.5.0'
+
+unless Vagrant.has_plugin?('vagrant-berkshelf')
+  raise 'vagrant-berkshelf is not installed!'
+end
+
+unless Vagrant.has_plugin?('vagrant-omnibus')
+  raise 'vagrant-omnibus is not installed!'
+end
+
+xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  config.vm.define 'xenserver' do |xenserver|
+    xenserver.vm.box = 'duffy/xenserver'
+
+    ## Map host only networks and the adapters
+    xenserver.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
+      v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
+      v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
+    end
+
+    # Configure Interface
+    ## Configure Management Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
+    end
+
+  end
+
+  config.vm.define 'management' do |management|
+    management.vm.box = 'chef/centos-6.5'
+
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
+
+    management.vm.network 'forwarded_port', guest: 3306, host: 3306
+
+    management.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--memory', 512]
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
+      v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
+    end
+
+    management.omnibus.chef_version = "11.16.4" 
+    management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
+    management.berkshelf.enabled = true
+
+    CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
+
+    management.vm.provision 'chef_solo' do |chef|
+      chef.run_list = CHEF_CONFIGURATION.delete('run_list')
+      chef.json = CHEF_CONFIGURATION
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/basic/chef_configuration.json
----------------------------------------------------------------------
diff --git a/tools/devcloud4/basic/chef_configuration.json b/tools/devcloud4/basic/chef_configuration.json
new file mode 100644
index 0000000..507a0de
--- /dev/null
+++ b/tools/devcloud4/basic/chef_configuration.json
@@ -0,0 +1,22 @@
+
+{
+  "run_list": [
+    "recipe[development-installation]",
+    "recipe[nat-router]"
+  ],
+  "set_fqdn": "*.localdomain",
+  "selinux": {
+      "state": "permissive"
+  },
+  "cloudstack": {
+      "secondary": {
+        "path": "/exports/secondary"
+      },
+      "primary": {
+        "path": "/exports/primary"
+      },
+      "hypervisor_tpl": {
+        "xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2"
+      }
+  }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/basic/marvin.cfg
----------------------------------------------------------------------
diff --git a/tools/devcloud4/basic/marvin.cfg b/tools/devcloud4/basic/marvin.cfg
new file mode 100644
index 0000000..dcc1b82
--- /dev/null
+++ b/tools/devcloud4/basic/marvin.cfg
@@ -0,0 +1,110 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+{
+    "zones": [
+        {
+            "name": "DevCloud-Basic-01",
+            "enabled": "True",
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone",
+                    "name": "Devcloud-Network-01",
+                    "traffictypes": [
+                        {
+                            "typ": "Guest"
+                        },
+                        {
+                            "typ": "Management"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "Pod",
+                            "name": "SecurityGroupProvider"
+                        }
+                    ]
+                }
+            ],
+            "dns2": "8.8.4.4",
+            "dns1": "8.8.8.8",
+            "securitygroupenabled": "true",
+            "localstorageenabled": "true",
+            "networktype": "Basic",
+            "pods": [
+                {
+                    "endip": "192.168.22.220",
+                    "name": "DevCloud-POD-01",
+                    "startip": "192.168.22.200",
+                    "guestIpRanges": [
+                        {
+                            "startip": "192.168.22.100",
+                            "endip": "192.168.22.199",
+                            "netmask": "255.255.255.0",
+                            "gateway": "192.168.22.5"
+                        }
+                    ],
+                    "netmask": "255.255.255.0",
+                    "clusters": [
+                        {
+                            "clustername": "DevCloud-CLUSTER-01",
+                            "hypervisor": "XenServer",
+                            "hosts": [
+                                {
+                                    "username": "root",
+                                    "url": "http://192.168.22.10/",
+                                    "password": "password"
+                                }
+                            ],
+                            "clustertype": "CloudManaged"
+                        }
+                    ],
+                    "gateway": "192.168.22.5"
+                }
+            ],
+            "internaldns1": "8.8.8.8",
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.22.5/exports/secondary",
+                    "provider": "NFS"
+                }
+            ]
+        }
+    ],
+    "logger": {
+        "LogFolderPath": "/tmp/"
+    },
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "192.168.22.1",
+            "port": 8096
+        }
+    ],
+    "dbSvr": {
+        "dbSvr": "127.0.0.1",
+        "port": 3306,
+        "user": "cloud",
+        "passwd": "cloud",
+        "db": "cloud"
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-advanced/Berksfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-advanced/Berksfile b/tools/devcloud4/binary-installation-advanced/Berksfile
new file mode 100644
index 0000000..7ad09e1
--- /dev/null
+++ b/tools/devcloud4/binary-installation-advanced/Berksfile
@@ -0,0 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+source "https://api.berkshelf.com"
+
+cookbook 'hostname'
+cookbook 'selinux'
+cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
+cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
+cookbook 'binary-installation', path: '../common/binary-installation'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-advanced/Vagrantfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-advanced/Vagrantfile b/tools/devcloud4/binary-installation-advanced/Vagrantfile
new file mode 100644
index 0000000..255efc0
--- /dev/null
+++ b/tools/devcloud4/binary-installation-advanced/Vagrantfile
@@ -0,0 +1,119 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
+
+is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/)
+
+virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end
+virtualbox_interface_1 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #2' else 'vboxnet1' end
+virtualbox_interface_2 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #3' else 'vboxnet2' end
+
+VAGRANTFILE_API_VERSION = '2'
+Vagrant.require_version '>= 1.5.0'
+
+unless Vagrant.has_plugin?('vagrant-berkshelf')
+  raise 'vagrant-berkshelf is not installed!'
+end
+
+unless Vagrant.has_plugin?('vagrant-omnibus')
+  raise 'vagrant-omnibus is not installed!'
+end
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  config.vm.define 'xenserver' do |xenserver|
+    xenserver.vm.box = 'duffy/xenserver'
+
+    # Public Network (IP address is ignored.)
+    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10'
+
+    # Guest Network (IP address is ignored.)
+    xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10'
+
+    ## Configure Management Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
+    end
+
+    ## Configure Public Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth2 na na PUBLIC)
+    end
+
+    ## Configure Guest Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth3 na na GUEST)
+    end
+
+    ## Map host only networks and the adapters
+    xenserver.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
+      v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
+      v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
+      v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
+      v.customize ['modifyvm', :id, '--hostonlyadapter4', virtualbox_interface_2]
+      v.customize ['modifyvm', :id, '--memory', 6144]
+    end
+
+    ## Tweak kernel
+    xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf"
+  end
+  
+  config.vm.define 'management' do |management|
+    management.vm.box = 'chef/centos-6.5'
+
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5'
+
+    management.vm.network 'forwarded_port', guest: 3306, host: 3306
+    management.vm.network 'forwarded_port', guest: 8080, host: 8080
+
+    management.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--memory', 2048]
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
+      v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
+    end
+
+    if Vagrant.has_plugin?('vagrant-cachier')
+      management.cache.scope = :box
+      management.cache.auto_detect = true
+      management.omnibus.cache_packages = true
+    end
+
+    management.omnibus.chef_version = "11.16.4" 
+    management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
+    management.berkshelf.enabled = true
+
+
+    CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
+
+    management.vm.provision :chef_solo do |chef|
+      chef.log_level = :debug
+      chef.run_list = CHEF_CONFIGURATION.delete('run_list')
+      chef.json = CHEF_CONFIGURATION
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-advanced/chef_configuration.json
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-advanced/chef_configuration.json b/tools/devcloud4/binary-installation-advanced/chef_configuration.json
new file mode 100644
index 0000000..ceae5d4
--- /dev/null
+++ b/tools/devcloud4/binary-installation-advanced/chef_configuration.json
@@ -0,0 +1,37 @@
+{
+  "run_list": [
+    "recipe[binary-installation]",
+    "recipe[nat-router]"
+  ],
+  "set_fqdn": "*.localdomain",
+  "selinux": {
+      "state": "permissive"
+  },
+  "cloudstack": {
+      "db": {
+        "user": "cloud",
+        "password": "cloud",
+        "rootusername": "root",
+        "rootpassword": "password",
+        "management_server_key": "password",
+        "database_key": "password",
+        "prefill": "/vagrant/prefill.sql"
+      },
+      "secondary": {
+        "path": "/exports/secondary"
+      },
+      "primary": {
+        "path": "/exports/primary"
+      },
+      "hypervisor_tpl": {
+        "xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2"
+      },
+      "configuration": "/vagrant/marvin.cfg.erb",
+      "yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/",
+      "apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/",
+      "version": "4.5.0"
+  },
+  "iptables": {
+    "lans": ["eth1", "eth2"]
+  }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb
new file mode 100644
index 0000000..6c847fb
--- /dev/null
+++ b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb
@@ -0,0 +1,123 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+{
+    "zones": [
+        {
+            "name": "DevCloud-Advanced-01",
+            "guestcidraddress": "10.1.1.0/24",
+            "localstorageenabled": true,
+            "dns1": "8.8.8.8",
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone",
+                    "vlan": "100-200",
+                    "name": "DevCloud-Network-01",
+                    "traffictypes": [
+                        {
+                            "xen": "GUEST",
+                            "typ": "Guest"
+                        },
+                        {
+                            "xen": "MGMT",
+                            "typ": "Management"
+                        },
+                        {
+                            "xen": "PUBLIC",
+                            "typ": "Public"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VpcVirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "InternalLbVm"
+                        }
+                    ],
+                    "isolationmethods": [
+                        "VLAN"
+                    ]
+                }
+            ],
+            "ipranges": [
+                {
+                    "startip": "192.168.23.100",
+                    "endip": "192.168.23.120",
+                    "netmask": "255.255.255.0",
+                    "vlan": "untagged",
+                    "gateway": "192.168.23.5"
+                }
+            ],
+            "networktype": "Advanced",
+            "pods": [
+                {
+                    "startip": "192.168.22.100",
+                    "endip": "192.168.22.120",
+                    "name": "DevCloud-POD-01",
+                    "netmask": "255.255.255.0",
+                    "clusters": [
+                        {
+                            "clustername": "DevCloud-CLUSTER-01",
+                            "hypervisor": "XenServer",
+                            "hosts": [
+                                {
+                                    "username": "root",
+                                    "url": "http://192.168.22.10/",
+                                    "password": "password"
+                                }
+                            ],
+                            "clustertype": "CloudManaged"
+                        }
+                    ],
+                    "gateway": "192.168.22.5"
+                }
+            ],
+            "internaldns1": "8.8.8.8",
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.22.5/exports/secondary",
+                    "provider": "NFS",
+                    "details": [ ]
+                }
+            ]
+        }
+    ],
+    "logger": {
+        "LogFolderPath": "/tmp/"
+    },
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "<%= @management_server_ip %>",
+            "port": <%= @management_server_port %>
+        }
+    ],
+    "dbSvr": {
+        "dbSvr": "<%= @database_server_ip %>",
+        "port": <%= @database_server_port %>,
+        "user": "<%= @database_user %>",
+        "passwd": "<%= @database_password %>",
+        "db": "<%= @database %>"
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-basic/Berksfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-basic/Berksfile b/tools/devcloud4/binary-installation-basic/Berksfile
new file mode 100644
index 0000000..7ad09e1
--- /dev/null
+++ b/tools/devcloud4/binary-installation-basic/Berksfile
@@ -0,0 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+source "https://api.berkshelf.com"
+
+cookbook 'hostname'
+cookbook 'selinux'
+cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
+cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
+cookbook 'binary-installation', path: '../common/binary-installation'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-basic/Vagrantfile
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-basic/Vagrantfile b/tools/devcloud4/binary-installation-basic/Vagrantfile
new file mode 100644
index 0000000..acc9be7
--- /dev/null
+++ b/tools/devcloud4/binary-installation-basic/Vagrantfile
@@ -0,0 +1,83 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
+
+is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/)
+
+virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end
+
+VAGRANTFILE_API_VERSION = '2'
+Vagrant.require_version '>= 1.5.0'
+
+unless Vagrant.has_plugin?('vagrant-berkshelf')
+  raise 'vagrant-berkshelf is not installed!'
+end
+
+unless Vagrant.has_plugin?('vagrant-omnibus')
+  raise 'vagrant-omnibus is not installed!'
+end
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  config.vm.define 'xenserver' do |xenserver|
+    xenserver.vm.box = 'duffy/xenserver'
+
+    ## Configure Management Interface
+    xenserver.vm.provision 'shell' do |s|
+      s.path = xenserver_networking_script
+      s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
+    end
+
+    ## Map host only networks and the adapters
+    xenserver.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
+      v.customize ['modifyvm', :id, '--memory', 6144]
+    end
+  end
+  
+  config.vm.define 'management' do |management|
+    management.vm.box = 'chef/centos-6.5'
+
+    management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
+
+    management.vm.network 'forwarded_port', guest: 3306, host: 3306
+    management.vm.network 'forwarded_port', guest: 8080, host: 8080
+
+    management.vm.provider 'virtualbox' do |v|
+      v.customize ['modifyvm', :id, '--memory', 2048]
+      v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
+    end
+
+    management.omnibus.chef_version = "11.16.4"
+    management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
+    management.berkshelf.enabled = true
+
+
+    CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
+
+    management.vm.provision :chef_solo do |chef|
+      chef.run_list = CHEF_CONFIGURATION.delete('run_list')
+      chef.json = CHEF_CONFIGURATION
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-basic/chef_configuration.json
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-basic/chef_configuration.json b/tools/devcloud4/binary-installation-basic/chef_configuration.json
new file mode 100644
index 0000000..87464bf
--- /dev/null
+++ b/tools/devcloud4/binary-installation-basic/chef_configuration.json
@@ -0,0 +1,34 @@
+{
+  "run_list": [
+    "recipe[binary-installation]",
+    "recipe[nat-router]"
+  ],
+  "set_fqdn": "*.localdomain",
+  "selinux": {
+      "state": "permissive"
+  },
+  "cloudstack": {
+      "db": {
+        "user": "cloud",
+        "password": "cloud",
+        "rootusername": "root",
+        "rootpassword": "password",
+        "management_server_key": "password",
+        "database_key": "password",
+        "prefill": "/vagrant/prefill.sql"
+      },
+      "secondary": {
+        "path": "/exports/secondary"
+      },
+      "primary": {
+        "path": "/exports/primary"
+      },
+      "hypervisor_tpl": {
+        "xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2"
+      },
+      "configuration": "/vagrant/marvin.cfg.erb",
+      "yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/",
+      "apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/",
+      "version": "4.5.0"
+  }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/binary-installation-basic/marvin.cfg.erb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/binary-installation-basic/marvin.cfg.erb b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb
new file mode 100644
index 0000000..62415c9
--- /dev/null
+++ b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb
@@ -0,0 +1,109 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+{
+    "zones": [
+        {
+            "name": "DevCloud-Basic-01",
+            "enabled": "True",
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone",
+                    "name": "Devcloud-Network-01",
+                    "traffictypes": [
+                        {
+                            "typ": "Guest"
+                        },
+                        {
+                            "typ": "Management"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE",
+                            "name": "VirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "Pod",
+                            "name": "SecurityGroupProvider"
+                        }
+                    ]
+                }
+            ],
+            "dns2": "8.8.4.4",
+            "dns1": "8.8.8.8",
+            "securitygroupenabled": "true",
+            "localstorageenabled": "true",
+            "networktype": "Basic",
+            "pods": [
+                {
+                    "endip": "192.168.22.220",
+                    "name": "DevCloud-POD-01",
+                    "startip": "192.168.22.200",
+                    "guestIpRanges": [
+                        {
+                            "startip": "192.168.22.100",
+                            "endip": "192.168.22.199",
+                            "netmask": "255.255.255.0",
+                            "gateway": "192.168.22.5"
+                        }
+                    ],
+                    "netmask": "255.255.255.0",
+                    "clusters": [
+                        {
+                            "clustername": "DevCloud-CLUSTER-01",
+                            "hypervisor": "XenServer",
+                            "hosts": [
+                                {
+                                    "username": "root",
+                                    "url": "http://192.168.22.10/",
+                                    "password": "password"
+                                }
+                            ],
+                            "clustertype": "CloudManaged"
+                        }
+                    ],
+                    "gateway": "192.168.22.5"
+                }
+            ],
+            "internaldns1": "8.8.8.8",
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.22.5/exports/secondary",
+                    "provider": "NFS"
+                }
+            ]
+        }
+    ],
+    "logger": {
+        "LogFolderPath": "/tmp/"
+    },
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "<%= @management_server_ip %>",
+            "port": <%= @management_server_port %>
+        }
+    ],
+    "dbSvr": {
+        "dbSvr": "<%= @database_server_ip %>",
+        "port": <%= @database_server_port %>,
+        "user": "<%= @database_user %>",
+        "passwd": "<%= @database_password %>",
+        "db": "<%= @database %>"
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/README.md
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/README.md b/tools/devcloud4/common/binary-installation/README.md
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/attributes/database_server.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/attributes/database_server.rb b/tools/devcloud4/common/binary-installation/attributes/database_server.rb
new file mode 100644
index 0000000..35a388f
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/attributes/database_server.rb
@@ -0,0 +1,22 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+default['mysql']['server_root_password'] = node['cloudstack']['db']['rootpassword']
+default['mysql']['allow_remote_root'] = true
+default['mysql']['data_dir'] = '/data/mysql'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/attributes/default.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/attributes/default.rb b/tools/devcloud4/common/binary-installation/attributes/default.rb
new file mode 100644
index 0000000..3b3eba0
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/attributes/default.rb
@@ -0,0 +1,38 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+default['cloudstack']['db']['host'] = '127.0.0.1'
+default['cloudstack']['db']['user'] = 'cloud'
+default['cloudstack']['db']['password'] = 'password'
+default['cloudstack']['db']['rootusername'] = 'root'
+default['cloudstack']['db']['rootpassword'] = 'cloud'
+default['cloudstack']['db']['management_server_key'] = 'password'
+default['cloudstack']['db']['database_key'] = 'password'
+default['cloudstack']['db']['prefill'] = '/vagrant/prefill.sql'
+
+default['cloudstack']['secondary']['host'] = node['ipaddress']
+default['cloudstack']['secondary']['path'] = '/data/secondary'
+default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path']
+
+default['cloudstack']['primary']['host'] = node['ipaddress']
+default['cloudstack']['primary']['path'] = '/data/primary'
+default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path']
+
+
+default['cloudstack']['configuration'] = '/vagrant/marvin.cfg.erb'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/metadata.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/metadata.rb b/tools/devcloud4/common/binary-installation/metadata.rb
new file mode 100644
index 0000000..bc2f515
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/metadata.rb
@@ -0,0 +1,42 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+name 'binary-installation'
+maintainer 'Ian Duffy'
+maintainer_email 'ian@ianduffy.ie'
+license 'Apache 2'
+description 'Wrapper around several different cookbooks.'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version '0.1.0'
+
+depends 'mysql', '= 5.6.1'
+depends 'cloudstack', '>= 3.0.0'
+depends 'nfs', '>= 2.0.0'
+
+supports 'centos'
+supports 'redhat'
+supports 'debian'
+supports 'ubuntu'
+supports 'fedora'
+supports 'oracle'
+
+provides 'binary-installation::default'
+provides 'binary-installation::management_server'
+provides 'binary-installation::database_server'
+provides 'binary-installation::nfs_server'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/recipes/database_server.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/recipes/database_server.rb b/tools/devcloud4/common/binary-installation/recipes/database_server.rb
new file mode 100644
index 0000000..28a374c
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/recipes/database_server.rb
@@ -0,0 +1,24 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+include_recipe 'mysql::server'
+include_recipe 'mysql::client'
+
+include_recipe 'cloudstack::mysql_conf'
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/recipes/default.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/recipes/default.rb b/tools/devcloud4/common/binary-installation/recipes/default.rb
new file mode 100644
index 0000000..6dcd47c
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/recipes/default.rb
@@ -0,0 +1,27 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+service 'iptables' do
+  action [:disable, :stop]
+  only_if { platform?(%w{redhat centos fedora oracle}) }
+end
+
+include_recipe 'binary-installation::nfsshares'
+include_recipe 'binary-installation::database_server'
+include_recipe 'binary-installation::management_server'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/recipes/management_server.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/recipes/management_server.rb b/tools/devcloud4/common/binary-installation/recipes/management_server.rb
new file mode 100644
index 0000000..742f35f
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/recipes/management_server.rb
@@ -0,0 +1,57 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+include_recipe 'cloudstack::marvin'
+include_recipe 'cloudstack::management_server'
+
+cloudstack_setup_database node['cloudstack']['db']['host'] do
+  root_user node['cloudstack']['db']['rootusername']
+  root_password node['cloudstack']['db']['rootpassword']
+  user node['cloudstack']['db']['username']
+  password node['cloudstack']['db']['password']
+  action :create
+end
+
+cloudstack_prefill_database node['cloudstack']['db']['prefill'] do
+  ip node['cloudstack']['db']['host']
+  user node['cloudstack']['db']['username']
+  password node['cloudstack']['db']['password']
+end
+
+cloudstack_system_template 'xenserver' do
+  nfs_path node['cloudstack']['secondary']['path']
+  nfs_server node['cloudstack']['secondary']['host']
+  db_user node['cloudstack']['db']['username']
+  url node['cloudstack']['hypervisor_tpl']['xenserver']
+  db_password node['cloudstack']['db']['password']
+  db_host node['cloudstack']['db']['host']
+  action :create
+end
+
+cloudstack_setup_management node.name
+
+service 'cloudstack-management' do
+  action [:enable, :start]
+end
+
+cloudstack_configure_cloud node['cloudstack']['configuration'] do
+  database_server_ip node['cloudstack']['db']['host']
+  database_user node['cloudstack']['db']['username']
+  database_password node['cloudstack']['db']['password']
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb b/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb
new file mode 100644
index 0000000..100eab9
--- /dev/null
+++ b/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb
@@ -0,0 +1,48 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+include_recipe 'nfs::server'
+
+directory node['cloudstack']['secondary']['path'] do
+  owner 'root'
+  group 'root'
+  action :create
+  recursive true
+end
+
+nfs_export node['cloudstack']['secondary']['path'] do
+  network '*'
+  writeable true
+  sync false
+  options %w(no_root_squash no_subtree_check)
+end
+
+directory node['cloudstack']['primary']['path'] do
+  owner 'root'
+  group 'root'
+  action :create
+  recursive true
+end
+
+nfs_export node['cloudstack']['primary']['path'] do
+  network '*'
+  writeable true
+  sync false
+  options %w(no_root_squash no_subtree_check)
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/configure-network.sh
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/configure-network.sh b/tools/devcloud4/common/configure-network.sh
new file mode 100644
index 0000000..dde115d
--- /dev/null
+++ b/tools/devcloud4/common/configure-network.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Usage ./reset-network.sh interface ip netmask
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+[ $# -lt 3 ] && { echo -e "Missing arguments\nUsage: ./reset-network interface ip netmask label"; exit 1; }
+
+. /etc/xensource-inventory
+
+PIF=$(/usr/bin/xe pif-introduce device=$1 host-uuid=${INSTALLATION_UUID})
+
+NETWORKPIF=$(/usr/bin/xe pif-list uuid=${PIF} params="network-uuid" --minimal)
+/usr/bin/xe network-param-set uuid=${NETWORKPIF} name-label=${4}
+
+if [ ${4} == "MGMT" ]
+then
+	/usr/bin/xe pif-reconfigure-ip uuid=${PIF} mode=static ip=${2} netmask=${3}
+	/usr/bin/xe host-management-reconfigure pif-uuid=${PIF}
+else
+	/usr/bin/xe pif-plug uuid=${PIF}
+fi

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/README.md
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/README.md b/tools/devcloud4/common/development-installation/README.md
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/attributes/database_server.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/attributes/database_server.rb b/tools/devcloud4/common/development-installation/attributes/database_server.rb
new file mode 100644
index 0000000..314f9c1
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/attributes/database_server.rb
@@ -0,0 +1,22 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+default['mysql']['server_root_password'] = ''
+default['mysql']['allow_remote_root'] = true
+default['mysql']['data_dir'] = '/data/mysql'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/attributes/default.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/attributes/default.rb b/tools/devcloud4/common/development-installation/attributes/default.rb
new file mode 100644
index 0000000..705423b
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/attributes/default.rb
@@ -0,0 +1,29 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+default['cloudstack']['secondary']['host'] = node['ipaddress']
+default['cloudstack']['secondary']['path'] = '/data/secondary'
+default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path']
+
+default['cloudstack']['primary']['host'] = node['ipaddress']
+default['cloudstack']['primary']['path'] = '/data/primary'
+default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path']
+
+default['cloudstack']['cloud-install-sys-tmplt'] = "#{Chef::Config['file_cache_path']}/cloud-install-sys-tmplt"
+default['cloudstack']['createtmplt'] = "#{Chef::Config['file_cache_path']}/createtmplt.sh"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt b/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt
new file mode 100755
index 0000000..313b599
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt
@@ -0,0 +1,288 @@
+#!/usr/bin/env bash
+# $Id: installrtng.sh 11251 2010-07-23 23:40:44Z abhishek $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/secondary/installrtng.sh $
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+usage() {
+  printf "Usage: %s: -m <secondary storage mount point> -f <system vm template file> [-h <hypervisor name: kvm|vmware|xenserver|hyperv> ] [ -s <mgmt server secret key, if you specified any when running cloudstack-setup-database, default is password>][-u <Url to system vm template>] [-F <clean up system templates of specified hypervisor>] [-e <Template suffix, e.g vhd, ova, qcow2>] [-o <Database server hostname or ip, e.g localhost>] [-r <Database user name, e.g root>] [-d <Database password. Fllowed by nothing if the password is empty>]\n" $(basename $0) >&2
+  printf "or\n" >&2
+  printf "%s: -m <secondary storage mount point> -u <http url for system vm template> [-h <hypervisor name: kvm|vmware|xenserver|hyperv> ] [ -s <mgmt server secret key>]\n" $(basename $0) >&2
+}
+
+failed() {
+  echo "Installation failed"
+  exit $1
+}
+#set -x
+mflag=
+fflag=
+ext="vhd"
+templateId=
+hyper=
+msKey=password
+DISKSPACE=5120000  #free disk space required in kilobytes
+dbHost=
+dbUser=
+dbPassword=
+name=
+jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.0.jar'
+while getopts 'm:h:f:u:Ft:e:s:o:r:d:n:' OPTION
+do
+  case $OPTION in
+  m)	mflag=1
+		mntpoint="$OPTARG"
+		;;
+  f)	fflag=1
+		tmpltimg="$OPTARG"
+		;;
+  u)	uflag=1
+		url="$OPTARG"
+		;;
+  F)	Fflag=1 ;;
+  t)    templateId="$OPTARG"
+  		;;
+  e)    ext="$OPTARG"
+  		;;
+  h)    hyper="$OPTARG"
+  		;;
+  s)    sflag=1
+		msKey="$OPTARG"
+                ;;
+  o)    oflag=1
+        dbHost="$OPTARG"
+                ;;
+  r)    rflag=1
+        dbUser="$OPTARG"
+                ;;
+  d)    dflag=1
+        dbPassword="$OPTARG"
+                ;;
+  n)    nflag=1
+        name="$OPTARG"
+                ;;
+  ?)	usage
+		failed 2
+		;;
+  esac
+done
+
+if [[ "$mflag$fflag" != "11"  && "$mflag$uflag" != "11" ]]
+then
+  usage
+  failed 2
+fi
+
+if [ -z "$hyper" ]
+then
+  usage
+  failed 2
+fi
+
+if [ ! -d $mntpoint ] 
+then
+  echo "mount point $mntpoint doesn't exist\n"
+  failed 4
+fi
+
+if [[ "$fflag" == "1" && ! -f $tmpltimg ]] 
+then
+  echo "template image file $tmpltimg doesn't exist"
+  failed 3
+fi
+
+
+if [ "$oflag" != 1 ]; then
+    dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+fi
+if [ "$rflag" != 1 ]; then
+    dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+fi
+
+if [ -f /etc/cloudstack/management/db.properties ]; then
+    encType=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.encryption.type'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+    if [ "$encType" == "file" ]
+    then
+        msKey=$(cat /etc/cloudstack/management/key)
+    elif [ "$encType" == "web" ]
+    then
+        if [ ! "$sflag" == "1" ]
+        then
+            echo "Encryption type web requires mgmt secret key using -s option"
+            failed 9
+        fi
+    fi
+fi
+
+if [[ "$encType" == "file" || "$encType" == "web" ]]
+then
+	encPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i | sed 's/^ENC(\(.*\))/\1/')
+	if [ ! $encPassword == "" ]
+	then
+		dbPassword=(`java -classpath $jasypt org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$encPassword password=$msKey verbose=false`)
+		if [ ! $dbPassword ]
+		then
+			echo "Failed to decrypt DB password from db.properties"
+			failed 9
+		fi
+	fi
+else
+    if [ "$dflag" != 1 ]; then
+        dbPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i )
+    fi
+fi
+
+if [ "$templateId" == "" ]
+then
+   if [ "$hyper" == "kvm" ]
+   then
+      ext="qcow2"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"KVM\" and removed is null"`)
+   elif [ "$hyper" == "xenserver" ]
+   then
+      ext="vhd"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"XenServer\" and removed is null"`)
+   elif [ "$hyper" == "vmware" ]
+   then
+      ext="ova"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"VMware\" and removed is null"`)
+   elif [ "$hyper" == "lxc" ]
+   then
+      ext="qcow2"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"LXC\" and removed is null"`)
+   elif [ "$hyper" == "hyperv" ]
+   then
+      ext="vhd"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"Hyperv\" and removed is null"`)
+   else
+      usage
+      failed 2
+   fi
+fi
+
+if [ ! $templateId ]
+then
+	echo "Unable to get template Id from database"
+	failed 8
+fi
+
+localfile=$(uuidgen).$ext
+
+mntpoint=`echo "$mntpoint" | sed 's|/*$||'`
+
+destdir=$mntpoint/template/tmpl/1/$templateId/
+
+mkdir -p $destdir
+if [ $? -ne 0 ]
+then
+  printf "Failed to write to mount point $mntpoint -- is it mounted?\n"
+  failed 3
+fi
+
+if [ "$Fflag" == "1" ]
+then
+  rm -rf $destdir/*
+  if [ $? -ne 0 ]
+  then
+    echo "Failed to clean up template directory $destdir -- check permissions?"
+    failed 2
+  fi
+fi
+
+if [ -f $destdir/template.properties ]
+then
+  echo "Data already exists at destination $destdir -- use -F to force cleanup of old template"
+  echo "IF YOU ARE ATTEMPTING AN UPGRADE, YOU MAY NEED TO SPECIFY A TEMPLATE ID USING THE -t FLAG"
+  failed 4
+fi
+
+destvhdfiles=$(find $destdir -name \*.$ext)
+if [ "$destvhdfiles" != "" ]
+then
+  echo "Data already exists at destination $destdir -- use -F to force cleanup of old template"
+  failed 5
+fi
+
+tmpfile=$(dirname $0)/$localfile
+
+touch $tmpfile
+if [ $? -ne 0 ]
+then
+  printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
+  failed 4
+fi
+
+destcap=$(df -P $destdir | awk '{print $4}' | tail -1 )
+[ $destcap -lt $DISKSPACE ] && echo "Insufficient free disk space for target folder $destdir: avail=${destcap}k req=${DISKSPACE}k" && failed 4
+
+localcap=$(df -P $(dirname $0) | awk '{print $4}' | tail -1 )
+[ $localcap -lt $DISKSPACE ] && echo "Insufficient free disk space for local temporary folder $(dirname $0): avail=${localcap}k req=${DISKSPACE}k" && failed 4
+
+if [ "$uflag" == "1" ]
+then
+  wget -O $tmpfile $url
+  if [ $? -ne 0 ]
+  then
+    echo "Failed to fetch system vm template from $url"
+    failed 5
+  fi
+fi
+
+
+if [ "$fflag" == "1" ]
+then
+  cp $tmpltimg $tmpfile
+  if [ $? -ne 0 ]
+  then
+    printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
+    failed 6
+  fi
+fi
+
+
+installrslt=$($(dirname $0)/createtmplt.sh -s 2 -d 'SystemVM Template' -n $localfile -t $destdir/ -f $tmpfile -u -v)
+
+if [ $? -ne 0 ]
+then
+  echo "Failed to install system vm template $tmpltimg to $destdir: $installrslt"
+  failed 7
+fi
+
+if [ "$nflag" != "1" ]
+then
+  uniquename=routing-$templateId
+fi
+
+if [ "$ext" == "ova" ]
+then
+  tar xvf $destdir/$localfile -C $destdir &> /dev/null
+fi
+
+tmpltfile=$destdir/$localfile
+tmpltsize=$(ls -l $tmpltfile| awk -F" " '{print $5}')
+
+echo "$ext=true" >> $destdir/template.properties
+echo "id=$templateId" >> $destdir/template.properties
+echo "public=true" >> $destdir/template.properties
+echo "$ext.filename=$localfile" >> $destdir/template.properties
+echo "uniquename=$uniquename" >> $destdir/template.properties
+echo "$ext.virtualsize=$tmpltsize" >> $destdir/template.properties
+echo "virtualsize=$tmpltsize" >> $destdir/template.properties
+echo "$ext.size=$tmpltsize" >> $destdir/template.properties
+
+echo "Successfully installed system VM template $tmpltimg to $destdir"


[17/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: removed identical override for CitrixResourceBase method
transferManagementNetwork

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/72b24226
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/72b24226
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/72b24226

Branch: refs/heads/reporter
Commit: 72b24226236b586d6056a461b660b3bcd9a84ae3
Parents: 332da26
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:10:20 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:10:20 2015 +0200

----------------------------------------------------------------------
 .../xenserver/resource/XenServer56Resource.java | 44 +++-----------------
 1 file changed, 6 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/72b24226/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
index 12e4fc5..b164963 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer56Resource.java
@@ -23,21 +23,20 @@ import java.util.List;
 import javax.ejb.Local;
 
 import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
 
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.resource.ServerResource;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import com.cloud.utils.ssh.SSHCmdHelper;
 import com.xensource.xenapi.Connection;
 import com.xensource.xenapi.Host;
 import com.xensource.xenapi.Network;
 import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Types.IpConfigurationMode;
 import com.xensource.xenapi.Types.XenAPIException;
 import com.xensource.xenapi.VLAN;
 
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.resource.ServerResource;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+import com.cloud.utils.ssh.SSHCmdHelper;
+
 @Local(value = ServerResource.class)
 public class XenServer56Resource extends CitrixResourceBase {
     private final static Logger s_logger = Logger.getLogger(XenServer56Resource.class);
@@ -143,37 +142,6 @@ public class XenServer56Resource extends CitrixResourceBase {
     }
 
     @Override
-    public boolean transferManagementNetwork(final Connection conn, final Host host, final PIF src, final PIF.Record spr, final PIF dest) throws XmlRpcException, XenAPIException {
-        dest.reconfigureIp(conn, spr.ipConfigurationMode, spr.IP, spr.netmask, spr.gateway, spr.DNS);
-        Host.managementReconfigure(conn, dest);
-        String hostUuid = null;
-        final int count = 0;
-        while (count < 10) {
-            try {
-                Thread.sleep(10000);
-                hostUuid = host.getUuid(conn);
-                if (hostUuid != null) {
-                    break;
-                }
-            } catch (final XmlRpcException e) {
-                s_logger.debug("Waiting for host to come back: " + e.getMessage());
-            } catch (final XenAPIException e) {
-                s_logger.debug("Waiting for host to come back: " + e.getMessage());
-            } catch (final InterruptedException e) {
-                s_logger.debug("Gotta run");
-                return false;
-            }
-        }
-        if (hostUuid == null) {
-            s_logger.warn("Unable to transfer the management network from " + spr.uuid);
-            return false;
-        }
-
-        src.reconfigureIp(conn, IpConfigurationMode.NONE, null, null, null, null);
-        return true;
-    }
-
-    @Override
     public StartupCommand[] initialize() {
         pingXAPI();
         final StartupCommand[] cmds = super.initialize();


[48/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8374: Adding tests for guest traffic port group verification - VPC network


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e81161de
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e81161de
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e81161de

Branch: refs/heads/reporter
Commit: e81161def830f8a3ea79d1ff2332d498e12b7eed
Parents: 9777e90
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Apr 14 15:30:21 2015 +0530
Committer: Gaurav Aradhye <ga...@clogeny.com>
Committed: Tue Apr 14 18:17:17 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc_vm_life_cycle.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81161de/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index d146af1..e185e96 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -43,7 +43,8 @@ from marvin.lib.common import (get_domain,
                                            wait_for_cleanup,
                                            list_virtual_machines,
                                            list_hosts,
-                                           findSuitableHostForMigration)
+                                           findSuitableHostForMigration,
+                                           verifyGuestTrafficPortGroups)
 
 from marvin.codes import PASS, ERROR_NO_HOST_FOR_MIGRATION
 
@@ -1734,6 +1735,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
         cls.api_client = cls.testClient.getApiClient()
 
         cls.services = Services().services
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -2060,6 +2062,17 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
                          )
         return
 
+    @attr(tags=["advanced", "dvs"], required_hardware="true")
+    def test_guest_traffic_port_groups_vpc_network(self):
+        """ Verify port groups are created for guest traffic
+        used by vpc network """
+
+        if self.hypervisor.lower() == "vmware":
+            response = verifyGuestTrafficPortGroups(self.apiclient,
+                                                    self.config,
+                                                    self.zone)
+            assert response[0] == PASS, response[1]
+
 class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
 
     @classmethod


[04/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
new file mode 100644
index 0000000..4b6cc3a
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
@@ -0,0 +1,37 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.api.commands;
+
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+
+import com.cloud.network.Network.Provider;
+
+public class BcfConstants {
+    public static final String BIGSWITCH_BCF_DEVICE_ID = "bcfdeviceid";
+    public static final String BIGSWITCH_BCF_DEVICE_NAME = "bigswitchdevicename";
+    public static final String BIGSWITCH_BCF_DEVICE_NAT = "nat";
+    public static final String EVENT_EXTERNAL_BCF_CONTROLLER_ADD = "PHYSICAL.BCFCONTROLLER.ADD";
+    public static final String EVENT_EXTERNAL_BCF_CONTROLLER_DELETE = "PHYSICAL.BCFCONTROLLER.DELETE";
+
+    public static final Provider BigSwitchBcf = new Provider("BigSwitchBcf", true);
+
+    public static final NetworkDevice BigSwitchBcfDevice = new NetworkDevice("BigSwitchBcf", BigSwitchBcf.getName());
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
new file mode 100644
index 0000000..520be8d
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
@@ -0,0 +1,110 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.api.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.api.response.BigSwitchBcfDeviceResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.element.BigSwitchBcfElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "deleteBigSwitchBcfDevice", responseObject = SuccessResponse.class, description = " delete a BigSwitch BCF Controller device", since = "4.6.0",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
+    private static final String s_name = "deletebigswitchbcfdeviceresponse";
+    @Inject
+    BigSwitchBcfElementService _bigswitchBcfElementService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = BcfConstants.BIGSWITCH_BCF_DEVICE_ID,
+               type = CommandType.UUID,
+               entityType = BigSwitchBcfDeviceResponse.class,
+               required = true,
+               description = "BigSwitch device ID")
+    private Long bigswitchBcfDeviceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getBigSwitchBcfDeviceId() {
+        return bigswitchBcfDeviceId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+        ResourceAllocationException {
+        try {
+            boolean result = _bigswitchBcfElementService.deleteBigSwitchBcfDevice(this);
+            if (result) {
+                SuccessResponse response = new SuccessResponse(getCommandName());
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete BigSwitch device.");
+            }
+        } catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return CallContext.current().getCallingAccount().getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Deleting BigSwitch BCF Controller";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
new file mode 100644
index 0000000..25c6752
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
@@ -0,0 +1,114 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+
+import com.cloud.api.response.BigSwitchBcfDeviceResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.network.element.BigSwitchBcfElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "listBigSwitchBcfDevices", responseObject = BigSwitchBcfDeviceResponse.class, description = "Lists BigSwitch BCF Controller devices", since = "4.6.0",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class ListBigSwitchBcfDevicesCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListBigSwitchBcfDevicesCmd.class.getName());
+    private static final String s_name = "listbigswitchbcfdeviceresponse";
+    @Inject
+    BigSwitchBcfElementService _bigswitchBcfElementService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the Physical Network ID")
+    private Long physicalNetworkId;
+
+    @Parameter(name = BcfConstants.BIGSWITCH_BCF_DEVICE_ID,
+               type = CommandType.UUID,
+               entityType = BigSwitchBcfDeviceResponse.class,
+               description = "bigswitch BCF controller device ID")
+    private Long bigswitchBcfDeviceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getBigSwitchBcfDeviceId() {
+        return bigswitchBcfDeviceId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+        ResourceAllocationException {
+        try {
+            List<BigSwitchBcfDeviceVO> bigswitchDevices = _bigswitchBcfElementService.listBigSwitchBcfDevices(this);
+            ListResponse<BigSwitchBcfDeviceResponse> response = new ListResponse<BigSwitchBcfDeviceResponse>();
+            List<BigSwitchBcfDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchBcfDeviceResponse>();
+
+            if (bigswitchDevices != null && !bigswitchDevices.isEmpty()) {
+                for (BigSwitchBcfDeviceVO bigswitchDeviceVO : bigswitchDevices) {
+                    BigSwitchBcfDeviceResponse bigswitchDeviceResponse = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchDeviceVO);
+                    bigswitchDevicesResponse.add(bigswitchDeviceResponse);
+                }
+            }
+
+            response.setResponses(bigswitchDevicesResponse);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
new file mode 100644
index 0000000..37906a5
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
@@ -0,0 +1,99 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.api.response;
+
+import com.google.gson.annotations.SerializedName;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.api.commands.BcfConstants;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.serializer.Param;
+
+@EntityReference(value = BigSwitchBcfDeviceVO.class)
+public class BigSwitchBcfDeviceResponse extends BaseResponse {
+    @SerializedName(BcfConstants.BIGSWITCH_BCF_DEVICE_ID)
+    @Param(description = "device id of the BigSwitch BCF Controller")
+    private String id;
+
+    @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
+    @Param(description = "the physical network to which this BigSwitch BCF segment belongs to")
+    private String physicalNetworkId;
+
+    @SerializedName(ApiConstants.PROVIDER)
+    @Param(description = "name of the provider")
+    private String providerName;
+
+    @SerializedName(BcfConstants.BIGSWITCH_BCF_DEVICE_NAME)
+    @Param(description = "device name")
+    private String deviceName;
+
+    @SerializedName(ApiConstants.HOST_NAME)
+    @Param(description = "the controller Ip address")
+    private String hostName;
+
+    @SerializedName(ApiConstants.USERNAME) @Param(description="the controller username")
+    private String username;
+
+    @SerializedName(ApiConstants.PASSWORD) @Param(description="the controller password")
+    private String password;
+
+    @SerializedName(BcfConstants.BIGSWITCH_BCF_DEVICE_NAT)
+    @Param(description = "NAT support")
+    private Boolean nat;
+
+    public String getId() {
+        return this.id;
+    }
+
+    public void setId(String bcfDeviceId) {
+        this.id = bcfDeviceId;
+    }
+
+    public void setPhysicalNetworkId(String physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    public void setProviderName(String providerName) {
+        this.providerName = providerName;
+    }
+
+    public void setDeviceName(String deviceName) {
+        this.deviceName = deviceName;
+    }
+
+    public void setHostName(String hostName) {
+        this.hostName = hostName;
+    }
+
+    public void setUserName(String username) {
+        this.username = username;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setNat(Boolean nat) {
+        this.nat = nat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
new file mode 100644
index 0000000..8c7269e
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
@@ -0,0 +1,143 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "external_bigswitch_bcf_devices")
+public class BigSwitchBcfDeviceVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = "host_id")
+    private long hostId;
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+
+    @Column(name = "provider_name")
+    private String providerName;
+
+    @Column(name = "device_name")
+    private String deviceName;
+
+    @Column(name = "hostname")
+    private String hostName;
+
+    @Column(name = "username")
+    private String userName;
+
+    @Column(name = "password")
+    private String password;
+
+    @Column(name = "nat")
+    private Boolean nat;
+
+    @Column(name = "hash")
+    private String hash;
+
+    public BigSwitchBcfDeviceVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public BigSwitchBcfDeviceVO(long hostId, long physicalNetworkId, String providerName, String deviceName,
+            String hostName, String username, String password, Boolean nat, String hash) {
+        super();
+        this.hostId = hostId;
+        this.physicalNetworkId = physicalNetworkId;
+        this.providerName = providerName;
+        this.deviceName = deviceName;
+        this.uuid = UUID.randomUUID().toString();
+        this.hostName = hostName;
+        this.userName = username;
+        this.password = password;
+        this.nat = nat;
+        this.hash = hash;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public String getProviderName() {
+        return providerName;
+    }
+
+    public String getDeviceName() {
+        return deviceName;
+    }
+
+    public String getHash() {
+        return hash;
+    }
+
+    public void setHash(String h) {
+        hash = h;
+    }
+
+    public String getHostName() {
+        return hostName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public Boolean getNat() {
+        return nat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
new file mode 100644
index 0000000..72b0cc9
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
@@ -0,0 +1,114 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import com.cloud.network.vpc.NetworkACLItem;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * AclData contains information expected by Big Switch Controller
+ * in ApplyBcfAclCommand
+ */
+
+public class AclData {
+    @SerializedName("id") private String id;
+    @SerializedName("priority") private int priority;
+    @SerializedName("action") private String action;
+    @SerializedName("ipproto") private String ipProto;
+    @SerializedName("source") private AclNetwork source;
+    @SerializedName("destination") private AclNetwork destination;
+
+    public AclData(){
+        this.id = null;
+        this.priority = 0;
+        this.action = null;
+        this.ipProto = null;
+        this.source = new AclNetwork();
+        this.destination = new AclNetwork();;
+    }
+
+    public class AclNetwork{
+        @SerializedName("cidr") private String cidr;
+        @SerializedName("port") private Integer port;
+
+        public AclNetwork(){
+            this.cidr = null;
+            this.port = null;
+        }
+
+        public AclNetwork(String cidr, Integer port){
+            this.cidr = cidr;
+            this.port = port;
+        }
+    }
+
+    public String getId() {
+        return id;
+    }
+    public void setId(String id) {
+        this.id = id;
+    }
+    public int getPriority() {
+        return priority;
+    }
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+    public String getAction() {
+        return action;
+    }
+    public void setAction(String action) {
+        if(action.equalsIgnoreCase(NetworkACLItem.Action.Allow.name())){
+            this.action = "permit";
+        } else {
+            this.action = "deny";
+        }
+    }
+    public String getIpProto() {
+        return ipProto;
+    }
+    public void setIpProto(String ipProto) {
+        if (!ipProto.equalsIgnoreCase("all")){
+            switch(ipProto.toLowerCase()){
+            case "tcp":
+                this.ipProto = "6";
+                break;
+            case "udp":
+                this.ipProto = "17";
+                break;
+            case "icmp":
+                this.ipProto = "1";
+                break;
+            }
+        }
+    }
+    public AclNetwork getSource() {
+        return source;
+    }
+    public void setSource(AclNetwork source) {
+        this.source = source;
+    }
+    public AclNetwork getDestination() {
+        return destination;
+    }
+    public void setDestination(AclNetwork destination) {
+        this.destination = destination;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
new file mode 100644
index 0000000..649f704
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
@@ -0,0 +1,142 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.util.ArrayList;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * AttachmentData contains information expected by Big Switch Controller
+ * in CreateBcfAttachmentCommand
+ */
+public class AttachmentData {
+    @SerializedName("port") private Attachment attachment;
+
+    public Attachment getAttachment() {
+        return this.attachment;
+    }
+
+    public AttachmentData() {
+        this.attachment = new Attachment();
+    }
+
+    public class Attachment {
+        @SerializedName("id") private String id;
+        @SerializedName("tenant_name") private String tenantName;
+        @SerializedName("vlan") private Integer vlan;
+        @SerializedName("fixed_ips") private ArrayList<IpAddress> fixedIps;
+        @SerializedName("mac_address") private String macAddress;
+        @SerializedName("bound_segment") private BoundSegment boundSegment;
+        @SerializedName("binding:host_id") private String hostId;
+
+        public Attachment(){
+            this.boundSegment = new BoundSegment();
+            this.fixedIps = new ArrayList<IpAddress>();
+        }
+
+        public class BoundSegment {
+            @SerializedName("segmentation_id") private Integer segmentationId;
+
+            public Integer getSegmentationId() {
+                return segmentationId;
+            }
+
+            public void setSegmentationId(Integer segmentationId) {
+                this.segmentationId = segmentationId;
+            }
+        }
+
+        public class IpAddress {
+            @SerializedName("ip_address") private String ipAddress;
+
+            public IpAddress(String ipAddr) {
+                this.ipAddress = ipAddr;
+            }
+
+            public String getIpAddress(){
+                return ipAddress;
+            }
+        }
+
+        private String state;
+
+        public String getTenantName() {
+            return tenantName;
+        }
+
+        public void setTenantName(String tenantName) {
+            this.tenantName = tenantName;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public String getHostId() {
+            return hostId;
+        }
+
+        public void setHostId(String hostId) {
+            this.hostId = hostId;
+        }
+
+        public Integer getVlan() {
+            return vlan;
+        }
+
+        public void setVlan(Integer vlan) {
+            this.vlan = vlan;
+            this.boundSegment.setSegmentationId(vlan);
+        }
+
+        public ArrayList<IpAddress> getIpv4List() {
+            return fixedIps;
+        }
+
+        public void addIpv4(String ipv4) {
+            this.fixedIps.add(new IpAddress(ipv4));
+        }
+
+        public String getMac() {
+            return macAddress;
+        }
+
+        public void setMac(String mac) {
+            this.macAddress = mac;
+        }
+
+        public BoundSegment getBoundSegment() {
+            return boundSegment;
+        }
+
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
new file mode 100644
index 0000000..5c1efb0
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
@@ -0,0 +1,459 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Type;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
+import org.apache.log4j.Logger;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+public class BigSwitchBcfApi {
+    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfApi.class);
+    private final static String s_protocol = "https";
+    private final static String s_nsBaseUri = "/networkService/v1.1";
+    private final static String CONTENT_TYPE = "Content-type";
+    private final static String ACCEPT = "Accept";
+    private final static String CONTENT_JSON = "application/json";
+    private final static String HTTP_HEADER_INSTANCE_ID = "Instance-ID";
+    private final static String CLOUDSTACK_INSTANCE_ID = "cloudstack";
+    private final static String HASH_MATCH = "X-BSN-BVS-HASH-MATCH";
+    private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
+
+    private String _host;
+    private String _username;
+    private String _password;
+    private String _hash;
+    private String _zoneId;
+    private Boolean _nat;
+
+    private boolean _isMaster = false;
+
+    private int _port = 8000;
+
+    private HttpClient _client;
+    private Gson gson = new Gson();
+
+    public final static String HASH_CONFLICT = "HASH_CONFLICT";
+    public final static String HASH_IGNORE = "HASH_IGNORE";
+
+    /* This factory method is protected so we can extend this
+     * in the unittests.
+     */
+    protected HttpClient createHttpClient() {
+        return new HttpClient(s_httpClientManager);
+    }
+
+    protected HttpMethod createMethod(String type, String uri, int port) throws BigSwitchBcfApiException {
+        String url;
+        try {
+            url = new URL(s_protocol, _host, port, uri).toString();
+        } catch (MalformedURLException e) {
+            s_logger.error("Unable to build Big Switch API URL", e);
+            throw new BigSwitchBcfApiException("Unable to build Big Switch API URL", e);
+        }
+
+        if ("post".equalsIgnoreCase(type)) {
+            return new PostMethod(url);
+        } else if ("get".equalsIgnoreCase(type)) {
+            return new GetMethod(url);
+        } else if ("delete".equalsIgnoreCase(type)) {
+            return new DeleteMethod(url);
+        } else if ("put".equalsIgnoreCase(type)) {
+            return new PutMethod(url);
+        } else {
+            throw new BigSwitchBcfApiException("Requesting unknown method type");
+        }
+    }
+
+    public BigSwitchBcfApi() {
+        _client = createHttpClient();
+        _client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
+
+        try {
+            // Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter
+            Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), _port));
+        } catch (IOException e) {
+            s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e);
+        }
+    }
+
+    /**
+     * Setter used by UI to set BSN controller address
+     * @param address
+     */
+    public void setControllerAddress(String address) {
+        this._host = address;
+    }
+
+    /**
+     * Setter used by UI to set BSN controller user name
+     * @param username
+     */
+    public void setControllerUsername(String username) {
+        this._username = username;
+    }
+
+    /**
+     * Setter used by UI to set BSN controller password
+     * @param password
+     */
+    public void setControllerPassword(String password) {
+        this._password = password;
+    }
+
+    /**
+     * Setter used by UI to set BSN controller NAT mode
+     * @param nat
+     */
+    public void setControllerNat(Boolean nat) {
+        this._nat = nat;
+    }
+
+    public boolean isNatEnabled() {
+        return this._nat;
+    }
+
+    /**
+     * Setter used by UI to set BSN controller password
+     * @param password
+     */
+    public void setZoneId(String zoneId) {
+        this._zoneId = zoneId;
+    }
+
+    public String createNetwork(NetworkData network) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + network.getNetwork().getTenantId() + "/networks";
+        return executeCreateObject(network, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String deleteNetwork(String tenantId, String networkId) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId;
+        return executeDeleteObject(uri);
+    }
+
+    public String createAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
+        return executeCreateObject(attachment, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String modifyAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
+        return executeUpdateObject(attachment, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String deleteAttachment(String tenantId, String networkId, String attachmentId) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachmentId + "/attachment";
+        return executeDeleteObject(uri);
+    }
+
+    public String createRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers";
+        return executeCreateObject(router, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String modifyRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException,
+    IllegalArgumentException{
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers";
+        return executeCreateObject(router, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String createRouterInterface(String tenantId, String routerId, RouterInterfaceData routerInterface) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers/" + routerId + "/interfaces";
+        return executeCreateObject(routerInterface, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String createFloatingIp(String tenantId, FloatingIpData fip) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips";
+        return executeCreateObject(fip, uri, Collections.<String, String> emptyMap());
+    }
+
+    public String deleteFloatingIp(String tenantId, String fipId) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips/" + fipId;
+        return executeDeleteObject(uri);
+    }
+
+    public ControlClusterStatus getControlClusterStatus() throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/health";
+        ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
+        }.getType(), uri, null);
+        ccs.setStatus(true);
+        return ccs;
+    }
+
+    public Capabilities getCapabilities() throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/capabilities";
+        List<String> capslist = executeRetrieveObject(new TypeToken<List<String>>() {
+        }.getType(), uri, null);
+        Capabilities caps = new Capabilities();
+        caps.setCapabilities(capslist);
+        return caps;
+    }
+
+    public String syncTopology(TopologyData topo) throws BigSwitchBcfApiException {
+        String uri = s_nsBaseUri + "/topology";
+        return executeCreateObject(topo, uri, Collections.<String, String> emptyMap());
+    }
+
+    public ControllerData getControllerData() {
+        return new ControllerData(_host, _isMaster);
+    }
+
+    private void checkInvariants() throws BigSwitchBcfApiException{
+        if (_host == null || _host.isEmpty()) {
+            throw new BigSwitchBcfApiException("Hostname is null or empty");
+        }
+        if (_username == null || _username.isEmpty()){
+            throw new BigSwitchBcfApiException("Username is null or empty");
+        }
+        if (_password == null || _password.isEmpty()){
+            throw new BigSwitchBcfApiException("Password is null or empty");
+        }
+    }
+
+    private String checkResponse(HttpMethodBase m, String errorMessageBase) throws BigSwitchBcfApiException,
+    IllegalArgumentException{
+        String customErrorMsg = null;
+        if (m.getStatusCode() == HttpStatus.SC_OK) {
+            String hash = "";
+            if (m.getResponseHeader(HASH_MATCH) != null) {
+                hash = m.getResponseHeader(HASH_MATCH).getValue();
+                set_hash(hash);
+            }
+            return hash;
+        }
+        if (m.getStatusCode() == HttpStatus.SC_CONFLICT) {
+            if(m instanceof GetMethod) {
+                return HASH_CONFLICT;
+            }
+            throw new BigSwitchBcfApiException("BCF topology sync required", true);
+        }
+        if (m.getStatusCode() == HttpStatus.SC_SEE_OTHER) {
+            _isMaster = false;
+            set_hash(HASH_IGNORE);
+            return HASH_IGNORE;
+        }
+        if (m.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
+            if (m instanceof DeleteMethod){
+                return "";
+            }
+        }
+        if (m.getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
+            customErrorMsg = " Invalid data in BCF request";
+            throw new IllegalArgumentException(customErrorMsg);
+        }
+        String errorMessage = responseToErrorMessage(m);
+        m.releaseConnection();
+        s_logger.error(errorMessageBase + errorMessage);
+        throw new BigSwitchBcfApiException(errorMessageBase + errorMessage + customErrorMsg);
+    }
+
+    private void setHttpHeader(HttpMethodBase m) {
+        m.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
+        m.setRequestHeader(ACCEPT, CONTENT_JSON);
+        m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + _zoneId);
+        if (_hash != "" ) {
+            m.setRequestHeader(HASH_MATCH, _hash);
+        }
+
+        String authString = _username + ":" + _password;
+        String encodedAuthString = "Basic " + Base64.encodeBase64String(authString.getBytes(Charset.forName("UTF-8")));
+        m.setRequestHeader("Authorization", encodedAuthString);
+    }
+
+    protected <T> String executeUpdateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException,
+    IllegalArgumentException{
+        checkInvariants();
+
+        PutMethod pm = (PutMethod)createMethod("put", uri, _port);
+
+        setHttpHeader(pm);
+
+        try {
+            pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), CONTENT_JSON, null));
+        } catch (UnsupportedEncodingException e) {
+            throw new BigSwitchBcfApiException("Failed to encode json request body", e);
+        }
+
+        executeMethod(pm);
+
+        String hash = checkResponse(pm, "BigSwitch HTTP update failed: ");
+
+        pm.releaseConnection();
+
+        return hash;
+    }
+
+    protected <T> String executeCreateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException {
+        checkInvariants();
+
+        PostMethod pm = (PostMethod)createMethod("post", uri, _port);
+
+        setHttpHeader(pm);
+
+        try {
+            pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), CONTENT_JSON, null));
+        } catch (UnsupportedEncodingException e) {
+            throw new BigSwitchBcfApiException("Failed to encode json request body", e);
+        }
+
+        executeMethod(pm);
+
+        String hash = checkResponse(pm, "BigSwitch HTTP create failed: ");
+
+        pm.releaseConnection();
+
+        return hash;
+    }
+
+    protected String executeDeleteObject(String uri) throws BigSwitchBcfApiException {
+        checkInvariants();
+
+        DeleteMethod dm = (DeleteMethod)createMethod("delete", uri, _port);
+
+        setHttpHeader(dm);
+
+        executeMethod(dm);
+
+        String hash = checkResponse(dm, "BigSwitch HTTP delete failed: ");
+
+        dm.releaseConnection();
+
+        return hash;
+    }
+
+    @SuppressWarnings("unchecked")
+    protected <T> T executeRetrieveObject(Type returnObjectType,
+            String uri, Map<String, String> parameters) throws BigSwitchBcfApiException {
+        checkInvariants();
+
+        GetMethod gm = (GetMethod)createMethod("get", uri, _port);
+
+        setHttpHeader(gm);
+
+        if (parameters != null && !parameters.isEmpty()) {
+            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(parameters.size());
+            for (Entry<String, String> e : parameters.entrySet()) {
+                nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue()));
+            }
+            gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0]));
+        }
+
+        executeMethod(gm);
+
+        String hash = checkResponse(gm, "BigSwitch HTTP get failed: ");
+
+        T returnValue;
+        try {
+            // CAUTIOUS: Safety margin of 2048 characters - extend if needed.
+            returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(2048), returnObjectType);
+        } catch (IOException e) {
+            s_logger.error("IOException while retrieving response body", e);
+            throw new BigSwitchBcfApiException(e);
+        } finally {
+            gm.releaseConnection();
+        }
+        if(returnValue instanceof ControlClusterStatus) {
+            if(hash == HASH_CONFLICT) {
+                _isMaster = true;
+                ((ControlClusterStatus) returnValue).setTopologySyncRequested(true);
+            } else if (hash != HASH_IGNORE && !_isMaster) {
+                _isMaster = true;
+                ((ControlClusterStatus) returnValue).setTopologySyncRequested(true);
+            }
+        }
+        return returnValue;
+    }
+
+    protected void executeMethod(HttpMethodBase method) throws BigSwitchBcfApiException {
+        try {
+            _client.executeMethod(method);
+            if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
+                method.releaseConnection();
+            }
+        } catch (HttpException e) {
+            s_logger.error("HttpException caught while trying to connect to the BigSwitch Controller", e);
+            method.releaseConnection();
+            throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e);
+        } catch (IOException e) {
+            s_logger.error("IOException caught while trying to connect to the BigSwitch Controller", e);
+            method.releaseConnection();
+            throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e);
+        }
+    }
+
+    private String responseToErrorMessage(HttpMethodBase method) {
+        assert method.isRequestSent() : "no use getting an error message unless the request is sent";
+
+        if ("text/html".equals(method.getResponseHeader(CONTENT_TYPE).getValue())) {
+            // The error message is the response content
+            // Safety margin of 2048 characters, anything longer is probably useless
+            // and will clutter the logs
+            try {
+                return method.getResponseBodyAsString(2048);
+            } catch (IOException e) {
+                s_logger.debug("Error while loading response body", e);
+            }
+        }
+
+        // The default
+        return method.getStatusText();
+    }
+
+    public static String getCloudstackInstanceId() {
+        return CLOUDSTACK_INSTANCE_ID;
+    }
+
+    public String get_hash() {
+        return _hash;
+    }
+
+    public void set_hash(String hash) {
+        this._hash = hash;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApiException.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApiException.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApiException.java
new file mode 100644
index 0000000..feed707
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApiException.java
@@ -0,0 +1,55 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+public class BigSwitchBcfApiException extends Exception {
+
+    private static final long serialVersionUID = -5864952230870945604L;
+    private boolean topologySyncRequested = false;
+
+    public BigSwitchBcfApiException() {
+    }
+
+    public BigSwitchBcfApiException(String message) {
+        super(message);
+    }
+
+    public BigSwitchBcfApiException(Throwable cause) {
+        super(cause);
+    }
+
+    public BigSwitchBcfApiException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public BigSwitchBcfApiException(String message, boolean syncRequest) {
+        super(message);
+        this.set_topologySyncRequested(syncRequest);
+    }
+
+    public boolean is_topologySyncRequested() {
+        return topologySyncRequested;
+    }
+
+    public void set_topologySyncRequested(boolean requested) {
+        this.topologySyncRequested = requested;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
new file mode 100644
index 0000000..b6e3359
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
@@ -0,0 +1,571 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.net.util.SubnetUtils;
+import org.apache.log4j.Logger;
+import org.bouncycastle.util.IPAddress;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.BcfAnswer;
+import com.cloud.agent.api.BcfCommand;
+import com.cloud.agent.api.CacheBcfTopologyCommand;
+import com.cloud.agent.api.GetControllerDataAnswer;
+import com.cloud.agent.api.GetControllerDataCommand;
+import com.cloud.agent.api.SyncBcfTopologyCommand;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.network.Network;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.bigswitch.TopologyData.Port;
+import com.cloud.network.dao.BigSwitchBcfDao;
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesCidrsVO;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.rules.FirewallRule.Purpose;
+import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.NetworkACLItemCidrsDao;
+import com.cloud.network.vpc.NetworkACLItemCidrsVO;
+import com.cloud.network.vpc.NetworkACLItemDao;
+import com.cloud.network.vpc.NetworkACLItemVO;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionStatus;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+public class BigSwitchBcfUtils {
+    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfUtils.class);
+
+    private final NetworkDao _networkDao;
+    private final NicDao _nicDao;
+    private final VMInstanceDao _vmDao;
+    private final HostDao _hostDao;
+    private final VpcDao _vpcDao;
+    private final BigSwitchBcfDao _bigswitchBcfDao;
+    private final AgentManager _agentMgr;
+    private final VlanDao _vlanDao;
+    private final IPAddressDao _ipAddressDao;
+    private final FirewallRulesDao _fwRulesDao;
+    private final FirewallRulesCidrsDao _fwCidrsDao;
+    private final NetworkACLItemDao _aclItemDao;
+    private final NetworkACLItemCidrsDao _aclItemCidrsDao;
+    private final NetworkModel _networkModel;
+
+    public BigSwitchBcfUtils(NetworkDao networkDao,
+            NicDao nicDao, VMInstanceDao vmDao, HostDao hostDao,
+            VpcDao vpcDao, BigSwitchBcfDao bigswitchBcfDao,
+            AgentManager agentMgr, VlanDao vlanDao, IPAddressDao ipAddressDao,
+            FirewallRulesDao fwRulesDao, FirewallRulesCidrsDao fwCidrsDao,
+            NetworkACLItemDao aclItemDao, NetworkACLItemCidrsDao aclItemCidrsDao,
+            NetworkModel networkModel){
+        _networkDao = networkDao;
+        _nicDao = nicDao;
+        _vmDao = vmDao;
+        _hostDao = hostDao;
+        _vpcDao = vpcDao;
+        _bigswitchBcfDao = bigswitchBcfDao;
+        _agentMgr = agentMgr;
+        _vlanDao = vlanDao;
+        _ipAddressDao = ipAddressDao;
+        _fwRulesDao = fwRulesDao;
+        _fwCidrsDao = fwCidrsDao;
+        _aclItemDao = aclItemDao;
+        _aclItemCidrsDao = aclItemCidrsDao;
+        _networkModel = networkModel;
+    }
+
+    public ControlClusterData getControlClusterData(long physicalNetworkId){
+        ControlClusterData cluster = new ControlClusterData();
+
+        // reusable command to query all devices
+        GetControllerDataCommand cmd = new GetControllerDataCommand();
+
+        // retrieve all registered BCF devices
+        List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listByPhysicalNetwork(physicalNetworkId);
+        for (BigSwitchBcfDeviceVO d: devices){
+            HostVO bigswitchBcfHost = _hostDao.findById(d.getHostId());
+            if (bigswitchBcfHost == null){
+                continue;
+            }
+
+            _hostDao.loadDetails(bigswitchBcfHost);
+            GetControllerDataAnswer answer = (GetControllerDataAnswer) _agentMgr.easySend(bigswitchBcfHost.getId(), cmd);
+            if (answer != null){
+                if (answer.isMaster()) {
+                    cluster.setMaster(bigswitchBcfHost);
+                } else {
+                    cluster.setSlave(bigswitchBcfHost);
+                }
+            }
+        }
+        return cluster;
+    }
+
+    public TopologyData getTopology(){
+        long physicalNetworkId;
+        List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll();
+        if(!devices.isEmpty()){
+            physicalNetworkId = devices.get(0).getPhysicalNetworkId();
+            return getTopology(physicalNetworkId);
+        } else {
+            return null;
+        }
+    }
+
+    public NetworkVO getPublicNetwork(long physicalNetworkId){
+        List<NetworkVO> pubNets = _networkDao.listByPhysicalNetworkTrafficType(physicalNetworkId, TrafficType.Public);
+        return pubNets.get(0);
+    }
+
+    public TopologyData getTopology(long physicalNetworkId){
+        List<NetworkVO> networks;
+        List<NicVO> nics;
+
+        networks = _networkDao.listByPhysicalNetworkTrafficType(physicalNetworkId, TrafficType.Guest);
+
+        TopologyData topo = new TopologyData();
+
+        // networks:
+        // - all user created networks (VPC or non-VPC)
+        // - one external network
+        // routers:
+        // - per VPC (handle in network loop)
+        // - per stand-alone network (handle in network loop)
+        // - one external router
+
+        // handle external network first, only if NAT service is enabled
+        if(networks != null) {
+            if(!(networks.isEmpty()) && isNatEnabled()!=null && isNatEnabled()){
+                // get public net info - needed to set up source nat gateway
+                NetworkVO pubNet = getPublicNetwork(physicalNetworkId);
+
+                // locate subnet info
+                SearchCriteria<VlanVO> sc = _vlanDao.createSearchCriteria();
+                sc.setParameters("network_id", pubNet.getId());
+                VlanVO vlanVO = _vlanDao.findOneBy(sc);
+
+                // add tenant external network external
+                TopologyData.Network network = topo.new Network();
+                network.setId("external");
+                network.setName("external");
+                network.setTenantId("external");
+                network.setTenantName("external");
+
+                String pubVlan = null;
+                try {
+                    pubVlan = BroadcastDomainType.getValue(vlanVO.getVlanTag());
+                    if(StringUtils.isNumeric(pubVlan)){
+                        network.setVlan(Integer.valueOf(pubVlan));
+                    } else {
+                        // untagged
+                        pubVlan = "0";
+                    }
+                } catch (URISyntaxException e) {
+                    e.printStackTrace();
+                }
+
+                topo.addNetwork(network);
+            }
+        }
+
+        // routerMap used internally for multiple updates to same tenant's router
+        // add back to topo.routers after loop
+        HashMap<String, RouterData> routerMap = new HashMap<String, RouterData>();
+
+        for (NetworkVO netVO: networks){
+            TopologyData.Network network = topo.new Network();
+            network.setId(netVO.getUuid());
+            network.setName(netVO.getName());
+
+            Integer vlan = null;
+            if (netVO.getBroadcastUri() != null) {
+                String vlanStr = BroadcastDomainType.getValue(netVO.getBroadcastUri());
+                if(StringUtils.isNumeric(vlanStr)){
+                    vlan = Integer.valueOf(vlanStr);
+                } else {
+                    // untagged
+                    vlan = 0;
+                }
+            }
+            network.setVlan(vlan);
+            network.setState(netVO.getState().name());
+
+            nics = _nicDao.listByNetworkId(netVO.getId());
+            List<Port> ports = new ArrayList<Port>();
+            String tenantId = null;
+            String tenantName = null;
+
+            // if VPC network, assign BCF tenant id with vpc uuid
+            Vpc vpc = null;
+            if(netVO.getVpcId()!=null){
+                vpc = _vpcDao.acquireInLockTable(netVO.getVpcId());
+            }
+
+            if (vpc != null) {
+                tenantId = vpc.getUuid();
+                tenantName = vpc.getName();
+            } else {
+                tenantId = netVO.getUuid();
+                tenantName = netVO.getName();
+            }
+
+            for(NicVO nic: nics){
+                NetworkData netData = new NetworkData();
+                TopologyData.Port p = topo.new Port();
+
+                p.setAttachmentInfo(netData.new AttachmentInfo(nic.getUuid(),nic.getMacAddress()));
+
+                VMInstanceVO vm = _vmDao.findById(nic.getInstanceId());
+                HostVO host = _hostDao.findById(vm.getHostId());
+
+                // if host not found, ignore this nic
+                if (host == null) {
+                    continue;
+                }
+
+                String hostname = host.getName();
+                long zoneId = netVO.getDataCenterId();
+                String vmwareVswitchLabel = _networkModel.getDefaultGuestTrafficLabel(zoneId, HypervisorType.VMware);
+                String[] labelArray = null;
+                String vswitchName = null;
+                if(vmwareVswitchLabel!=null){
+                    labelArray=vmwareVswitchLabel.split(",");
+                    vswitchName = labelArray[0];
+                }
+
+                // hypervisor type:
+                //   kvm: ivs port name
+                //   vmware: specific portgroup naming convention
+                String pgName = "";
+                if (host.getHypervisorType() == HypervisorType.KVM){
+                    pgName = hostname;
+                } else if (host.getHypervisorType() == HypervisorType.VMware){
+                    pgName = hostname + "-" + vswitchName;
+                }
+
+                p.setHostId(pgName);
+
+                p.setSegmentInfo(netData.new SegmentInfo(BroadcastDomainType.Vlan.name(), vlan));
+
+                p.setOwner(BigSwitchBcfApi.getCloudstackInstanceId());
+
+                List<AttachmentData.Attachment.IpAddress> ipList = new ArrayList<AttachmentData.Attachment.IpAddress>();
+                ipList.add(new AttachmentData().getAttachment().new IpAddress(nic.getIp4Address()));
+                p.setIpAddresses(ipList);
+
+                p.setId(nic.getUuid());
+
+                p.setMac(nic.getMacAddress());
+
+                netData.getNetwork().setId(network.getId());
+                netData.getNetwork().setName(network.getName());
+                netData.getNetwork().setTenantId(tenantId);
+                netData.getNetwork().setTenantName(tenantName);
+                netData.getNetwork().setState(netVO.getState().name());
+
+                p.setNetwork(netData.getNetwork());
+                ports.add(p);
+            }
+            network.setTenantId(tenantId);
+            network.setTenantName(tenantName);
+            network.setPorts(ports);
+            topo.addNetwork(network);
+
+            // add router for network
+            RouterData routerData;
+            if(tenantId != null){
+                if(!routerMap.containsKey(tenantId)){
+                    routerData = new RouterData(tenantId);
+                    routerMap.put(tenantId, routerData);
+                } else {
+                    routerData = routerMap.get(tenantId);
+                }
+
+                routerData.getRouter().getAcls().addAll(listACLbyNetwork(netVO));
+                if(vpc != null){
+                    routerData.getRouter().addExternalGateway(getPublicIpByVpc(vpc));
+                } else {
+                    routerData.getRouter().addExternalGateway(getPublicIpByNetwork(netVO));
+                }
+
+                RouterInterfaceData intf = new RouterInterfaceData(tenantId, netVO.getGateway(), netVO.getCidr(),
+                        netVO.getUuid(), netVO.getName());
+                routerData.getRouter().addInterface(intf);
+            }
+        }
+
+        for(RouterData rd: routerMap.values()) {
+            topo.addRouter(rd.getRouter());
+        }
+
+        return topo;
+    }
+
+    public String getPublicIpByNetwork(Network network){
+        List<IPAddressVO> allocatedIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), true);
+        for (IPAddressVO ip: allocatedIps){
+            if(ip.isSourceNat()){
+                return ip.getAddress().addr();
+            }
+        }
+        return null;
+    }
+
+    public String getPublicIpByVpc(Vpc vpc){
+        List<IPAddressVO> allocatedIps = _ipAddressDao.listByAssociatedVpc(vpc.getId(), true);
+        for (IPAddressVO ip: allocatedIps){
+            if(ip.isSourceNat()){
+                return ip.getAddress().addr();
+            }
+        }
+        return null;
+    }
+
+    public List<AclData> listACLbyNetwork(Network network){
+        List<AclData> aclList = new ArrayList<AclData>();
+
+        List<FirewallRuleVO> fwRules;
+        fwRules = _fwRulesDao.listByNetworkAndPurposeAndNotRevoked(network.getId(), Purpose.Firewall);
+        List<FirewallRulesCidrsVO> fwCidrList = null;
+        SubnetUtils utils;
+
+        for(FirewallRuleVO rule: fwRules){
+            AclData acl = new AclData();
+            acl.setId(rule.getUuid());
+            acl.setPriority((int)rule.getId()); // CloudStack Firewall interface does not have priority
+            acl.setIpProto(rule.getProtocol());
+            String cidr = null;
+            Integer port = rule.getSourcePortStart();
+            fwCidrList = _fwCidrsDao.listByFirewallRuleId(rule.getId());
+            if(fwCidrList != null){
+                if(fwCidrList.size()>1 || rule.getSourcePortEnd()!=port){
+                    continue;
+                } else {
+                    cidr = fwCidrList.get(0).getCidr();
+                }
+            }
+            if (cidr == null || cidr.equalsIgnoreCase("0.0.0.0/0")) {
+                cidr = "";
+            } else {
+                utils = new SubnetUtils(cidr);
+                if(!utils.getInfo().getNetworkAddress().equals(utils.getInfo().getAddress())){
+                    continue;
+                }
+            }
+            acl.setSource(acl.new AclNetwork(cidr, port));
+            acl.setAction("permit");
+
+            aclList.add(acl);
+        }
+
+        List<NetworkACLItemVO> aclItems;
+        List<NetworkACLItemCidrsVO> aclCidrList;
+
+        if (network.getNetworkACLId() != null){
+            aclItems = _aclItemDao.listByACL(network.getNetworkACLId());
+            for(NetworkACLItem item: aclItems){
+                AclData acl = new AclData();
+                acl.setId(item.getUuid());
+                acl.setPriority(item.getNumber());
+                acl.setIpProto(item.getProtocol());
+                String cidr = null; // currently BCF supports single cidr policy
+                Integer port = item.getSourcePortStart(); // currently BCF supports single port policy
+                aclCidrList = _aclItemCidrsDao.listByNetworkACLItemId(item.getId());
+                if(aclCidrList != null){
+                    if(aclCidrList.size()>1 || item.getSourcePortEnd()!=port){
+                        continue;
+                    } else {
+                        cidr = aclCidrList.get(0).getCidr();
+                    }
+                }
+                if (cidr == null || cidr.equalsIgnoreCase("0.0.0.0/0")) {
+                    cidr = "";
+                } else {
+                    utils = new SubnetUtils(cidr);
+                    if(!utils.getInfo().getNetworkAddress().equals(utils.getInfo().getAddress())){
+                        continue;
+                    }
+                }
+                acl.setSource(acl.new AclNetwork(cidr, port));
+                acl.setAction(item.getAction().name());
+
+                aclList.add(acl);
+            }
+        }
+
+        return aclList;
+    }
+
+    public String syncTopologyToBcfHost(HostVO bigswitchBcfHost){
+        SyncBcfTopologyCommand syncCmd;
+        if(isNatEnabled()!=null && isNatEnabled()){
+            syncCmd = new SyncBcfTopologyCommand(true, true);
+        } else {
+            syncCmd = new SyncBcfTopologyCommand(true, false);
+        }
+        BcfAnswer syncAnswer = (BcfAnswer) _agentMgr.easySend(bigswitchBcfHost.getId(), syncCmd);
+        if (syncAnswer == null || !syncAnswer.getResult()) {
+            s_logger.error("SyncBcfTopologyCommand failed");
+            return null;
+        }
+        return syncAnswer.getHash();
+    }
+
+    public String syncTopologyToBcfHost(HostVO bigswitchBcfHost, boolean natEnabled){
+        SyncBcfTopologyCommand syncCmd;
+        if(natEnabled){
+            syncCmd = new SyncBcfTopologyCommand(true, true);
+        } else {
+            syncCmd = new SyncBcfTopologyCommand(true, false);
+        }
+        BcfAnswer syncAnswer = (BcfAnswer) _agentMgr.easySend(bigswitchBcfHost.getId(), syncCmd);
+        if (syncAnswer == null || !syncAnswer.getResult()) {
+            s_logger.error("SyncBcfTopologyCommand failed");
+            return null;
+        }
+        return syncAnswer.getHash();
+    }
+
+    public BcfAnswer sendBcfCommandWithNetworkSyncCheck(BcfCommand cmd, Network network)throws IllegalArgumentException{
+        // get registered Big Switch controller
+        ControlClusterData cluster = getControlClusterData(network.getPhysicalNetworkId());
+        if(cluster.getMaster()==null){
+            return new BcfAnswer(cmd, new CloudRuntimeException("Big Switch Network controller temporarily unavailable"));
+        }
+
+        TopologyData topo = getTopology(network.getPhysicalNetworkId());
+
+        cmd.setTopology(topo);
+        BcfAnswer answer =  (BcfAnswer) _agentMgr.easySend(cluster.getMaster().getId(), cmd);
+
+        if (answer == null || !answer.getResult()) {
+            s_logger.error ("BCF API Command failed");
+            throw new IllegalArgumentException("Failed API call to Big Switch Network plugin");
+        }
+
+        String newHash = answer.getHash();
+        if (cmd.is_topologySyncRequested()) {
+            newHash = syncTopologyToBcfHost(cluster.getMaster());
+        }
+        if(newHash != null){
+            commitTopologyHash(network.getPhysicalNetworkId(), newHash);
+        }
+
+        HostVO slave = cluster.getSlave();
+        if(slave != null){
+            TopologyData newTopo = getTopology(network.getPhysicalNetworkId());
+            CacheBcfTopologyCommand cacheCmd = new CacheBcfTopologyCommand(newTopo);
+            _agentMgr.easySend(cluster.getSlave().getId(), cacheCmd);
+        }
+
+        return answer;
+    }
+
+    @DB
+    public Boolean commitTopologyHash(long physicalNetworkId, final String hash) {
+        final List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listByPhysicalNetwork(physicalNetworkId);
+
+        return Transaction.execute(new TransactionCallback<Boolean>() {
+            @Override
+            public Boolean doInTransaction(TransactionStatus status) {
+                for (BigSwitchBcfDeviceVO d: devices){
+                    d.setHash(hash);
+                    _bigswitchBcfDao.update(d.getId(), d);
+                }
+                return true;
+            }
+        });
+    }
+
+    public Boolean isNatEnabled(){
+        List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll();
+        if(devices != null && !devices.isEmpty()){
+            return devices.get(0).getNat();
+        } else {
+            return null;
+        }
+    }
+
+    public Integer getSubnetMaskLength(String maskString){
+        if(!IPAddress.isValidIPv4(maskString)){
+            return null;
+        }
+        String[] octets = maskString.split(".");
+        Integer bits = 0;
+        for (String o: octets){
+            switch(o){
+            case "255":
+                bits += 8;
+                continue;
+            case "254":
+                bits += 7;
+                return bits;
+            case "252":
+                bits += 6;
+                return bits;
+            case "248":
+                bits += 5;
+                return bits;
+            case "240":
+                bits += 4;
+                return bits;
+            case "224":
+                bits += 3;
+                return bits;
+            case "192":
+                bits += 2;
+                return bits;
+            case "128":
+                bits += 1;
+                return bits;
+            case "0":
+                return bits;
+            default:
+                throw new NumberFormatException("non-contiguous subnet mask not supported");
+            }
+        }
+        return bits;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchStatus.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchStatus.java
new file mode 100644
index 0000000..0b3a895
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchStatus.java
@@ -0,0 +1,32 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+public class BigSwitchStatus {
+    private boolean topologySyncRequested = false;
+
+    public boolean isTopologySyncRequested() {
+        return topologySyncRequested;
+    }
+
+    public void setTopologySyncRequested(boolean topologySyncRequested) {
+        this.topologySyncRequested = topologySyncRequested;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/Capabilities.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/Capabilities.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/Capabilities.java
new file mode 100644
index 0000000..b033a84
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/Capabilities.java
@@ -0,0 +1,34 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.util.List;
+
+public class Capabilities extends BigSwitchStatus {
+    private List<String> capabilities;
+
+    public List<String> getCapabilities() {
+        return capabilities;
+    }
+
+    public void setCapabilities(List<String> caps) {
+        capabilities = caps;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterData.java
new file mode 100644
index 0000000..7d62899
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterData.java
@@ -0,0 +1,43 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import com.cloud.host.HostVO;
+
+public class ControlClusterData {
+    private HostVO master;
+    private HostVO slave;
+
+    public HostVO getMaster() {
+        return master;
+    }
+
+    public void setMaster(HostVO master) {
+        this.master = master;
+    }
+
+    public HostVO getSlave() {
+        return slave;
+    }
+
+    public void setSlave(HostVO slave) {
+        this.slave = slave;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterStatus.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterStatus.java
new file mode 100644
index 0000000..8a17bea
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControlClusterStatus.java
@@ -0,0 +1,32 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+public class ControlClusterStatus extends BigSwitchStatus {
+    private boolean healthy;
+
+    public boolean getStatus() {
+        return healthy;
+    }
+
+    public void setStatus(boolean status) {
+        this.healthy = status;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControllerData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControllerData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControllerData.java
new file mode 100644
index 0000000..224a7ab
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/ControllerData.java
@@ -0,0 +1,39 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+public class ControllerData {
+    private final String ipAddress;
+    private final boolean isMaster;
+
+    public ControllerData(String ipAddress, boolean isMaster) {
+        this.ipAddress = ipAddress;
+        this.isMaster = isMaster;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public boolean isMaster() {
+        return isMaster;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/FloatingIpData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/FloatingIpData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/FloatingIpData.java
new file mode 100644
index 0000000..6e2c422
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/FloatingIpData.java
@@ -0,0 +1,93 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import com.google.gson.annotations.SerializedName;
+
+public class FloatingIpData {
+    @SerializedName("router_id") private String routerId;
+    @SerializedName("tenant_id") private String tenantId;
+    @SerializedName("floating_network_id") private String networkId;
+    @SerializedName("fixed_ip_address") private String fixedIp;
+    @SerializedName("floating_ip_address") private String floatingIp;
+    @SerializedName("floating_mac_address") private String mac;
+    @SerializedName("id") private String id;
+
+    public FloatingIpData(){
+        this.mac = null;
+    }
+
+    public String getRouterId() {
+        return routerId;
+    }
+
+    public void setRouterId(String routerId) {
+        this.routerId = routerId;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getNetworkId() {
+        return networkId;
+    }
+
+    public void setNetworkId(String networkId) {
+        this.networkId = networkId;
+    }
+
+    public String getFixedIp() {
+        return fixedIp;
+    }
+
+    public void setFixedIp(String fixedIp) {
+        this.fixedIp = fixedIp;
+    }
+
+    public String getFloatingIp() {
+        return floatingIp;
+    }
+
+    /***
+     * current implementation auto-generates id using public ip
+     * replacing "." with "-"
+     ***/
+    public void setFloatingIpAndId(String floatingIp) {
+        this.floatingIp = floatingIp;
+        this.id = floatingIp.replace(".", "-");
+    }
+
+    public String getMac() {
+        return mac;
+    }
+
+    public void setMac(String mac) {
+        this.mac = mac;
+    }
+
+    public String getId() {
+        return id;
+    }
+}


[34/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
vmware: plugin improvements

- use sticky chmod 1777 on the mountpoint
- remove dead code

(cherry picked from commit eea716b7916c916442b19d14e0f6e5c57bebb91e)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7949d292
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7949d292
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7949d292

Branch: refs/heads/reporter
Commit: 7949d2922da725c1be112b2ec374f54ee4126c55
Parents: 04dccda
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:42:13 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:49:01 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java    | 2 +-
 .../src/com/cloud/hypervisor/vmware/resource/VmwareResource.java  | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7949d292/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 3416319..e852948 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -765,7 +765,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
 
         // Change permissions for the mountpoint
         script = new Script(true, "chmod", _timeout, s_logger);
-        script.add("777", mountPoint);
+        script.add("1777", mountPoint);
         result = script.execute();
         if (result != null) {
             s_logger.warn("Unable to set permissions for " + mountPoint + " due to " + result);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7949d292/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 07815ee..796999b 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1822,7 +1822,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
 
     int getReservedCpuMHZ(VirtualMachineTO vmSpec) {
          if (vmSpec.getDetails().get(VMwareGuru.VmwareReserveCpu.key()).equalsIgnoreCase("true")) {
-             return vmSpec.getMinSpeed();
+             return vmSpec.getMinSpeed() * vmSpec.getCpus();
          }
          return 0;
     }
@@ -2472,7 +2472,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
     private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, VirtualMachine.Type vmType) throws Exception {
 
         Ternary<String, String, String> switchDetails = getTargetSwitch(nicTo);
-        nicTo.getType();
         VirtualSwitchType switchType = VirtualSwitchType.getType(switchDetails.second());
         String switchName = switchDetails.first();
         String vlanToken = switchDetails.third();


[19/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: unnecesarry null return in utility function removed;
Category BAD_PRACTICE

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9f8a40ac
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9f8a40ac
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9f8a40ac

Branch: refs/heads/reporter
Commit: 9f8a40acd5e9cb3dc3c7ff8d69b34c8b2b405909
Parents: cb02a32
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:23:26 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:23:26 2015 +0200

----------------------------------------------------------------------
 .../com/cloud/network/bigswitch/BigSwitchBcfUtils.java    |  8 ++++----
 .../com/cloud/network/element/BigSwitchBcfElement.java    | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f8a40ac/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
index b6e3359..455535f 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
@@ -177,7 +177,7 @@ public class BigSwitchBcfUtils {
 
         // handle external network first, only if NAT service is enabled
         if(networks != null) {
-            if(!(networks.isEmpty()) && isNatEnabled()!=null && isNatEnabled()){
+            if (!(networks.isEmpty()) && isNatEnabled()) {
                 // get public net info - needed to set up source nat gateway
                 NetworkVO pubNet = getPublicNetwork(physicalNetworkId);
 
@@ -440,7 +440,7 @@ public class BigSwitchBcfUtils {
 
     public String syncTopologyToBcfHost(HostVO bigswitchBcfHost){
         SyncBcfTopologyCommand syncCmd;
-        if(isNatEnabled()!=null && isNatEnabled()){
+        if (isNatEnabled()) {
             syncCmd = new SyncBcfTopologyCommand(true, true);
         } else {
             syncCmd = new SyncBcfTopologyCommand(true, false);
@@ -519,12 +519,12 @@ public class BigSwitchBcfUtils {
         });
     }
 
-    public Boolean isNatEnabled(){
+    public boolean isNatEnabled() {
         List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll();
         if(devices != null && !devices.isEmpty()){
             return devices.get(0).getNat();
         } else {
-            return null;
+            return false;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f8a40ac/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
index 2de447e..37391a6 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
@@ -30,25 +30,26 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.commons.net.util.SubnetUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
-import org.apache.commons.net.util.SubnetUtils;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.BcfAnswer;
-import com.cloud.agent.api.UpdateBcfRouterCommand;
 import com.cloud.agent.api.CreateBcfAttachmentCommand;
 import com.cloud.agent.api.CreateBcfStaticNatCommand;
 import com.cloud.agent.api.DeleteBcfAttachmentCommand;
 import com.cloud.agent.api.DeleteBcfStaticNatCommand;
 import com.cloud.agent.api.StartupBigSwitchBcfCommand;
 import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.UpdateBcfRouterCommand;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd;
+import com.cloud.api.commands.BcfConstants;
 import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd;
 import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd;
-import com.cloud.api.commands.BcfConstants;
 import com.cloud.api.response.BigSwitchBcfDeviceResponse;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.dc.DataCenterVO;
@@ -451,8 +452,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             zoneName = String.valueOf(zoneId);
         }
 
-        Boolean natNow =  _bcfUtils.isNatEnabled();
-        if( natNow != null)
+        boolean natNow = _bcfUtils.isNatEnabled();
         if (!nat && natNow){
             throw new CloudRuntimeException("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first.");
         } else if (nat && !natNow){


[43/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
disable foreign key checks when altering them

Upgrades from 4.4 where not working properly due to errors like this:
ERROR 1833 (HY000): Cannot change column 'id': used in a foreign key constraint 'fk_global_load_balancing_rules_region_id' of table 'cloud.global_load_balancing_rules'

The disabling of the checks is for the current session only, so it's safe.

In the 4.4 branch, this file used to be at:
client/target/utilities/scripts/db/db/schema-442to450.sql

It's now moved. We need to edit it in 4.4 and 4.5 to have it effective.

This closes #164

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8f4abbc7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8f4abbc7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8f4abbc7

Branch: refs/heads/reporter
Commit: 8f4abbc7bd65e7a7cad67ba64b29d745aa0869c0
Parents: bb4f234
Author: Remi Bergsma <gi...@remi.nl>
Authored: Mon Apr 13 16:38:17 2015 -0500
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 14 14:50:58 2015 +0530

----------------------------------------------------------------------
 setup/db/db/schema-442to450.sql | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f4abbc7/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index 4a8f250..774eee5 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -37,6 +37,7 @@ ALTER TABLE `cloud`.`volumes` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NUL
 ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume';
 
 -- Have primary keys of following table AUTO_INCREMENT
+SET foreign_key_checks = 0;
 ALTER TABLE `cloud`.`region` MODIFY `id` int unsigned AUTO_INCREMENT UNIQUE NOT NULL;
 ALTER TABLE `cloud`.`vm_instance` MODIFY `id` bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL;
 ALTER TABLE `cloud`.`user_vm` MODIFY `id` bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL;
@@ -44,6 +45,7 @@ ALTER TABLE `cloud`.`domain_router` MODIFY `id` bigint unsigned AUTO_INCREMENT U
 ALTER TABLE `cloud`.`service_offering` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
 ALTER TABLE `cloud`.`load_balancing_rules` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
 ALTER TABLE `cloud`.`port_forwarding_rules` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
+SET foreign_key_checks = 1;
 
 DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
 CREATE VIEW `cloud`.`disk_offering_view` AS


[20/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: .equals() on wrapper class

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6f2fb923
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6f2fb923
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6f2fb923

Branch: refs/heads/reporter
Commit: 6f2fb9236490a45c120a0d767eae6833a03cc456
Parents: 9f8a40a
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:27:23 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:27:23 2015 +0200

----------------------------------------------------------------------
 .../src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f2fb923/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
index 455535f..676275a 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
@@ -380,7 +380,7 @@ public class BigSwitchBcfUtils {
             Integer port = rule.getSourcePortStart();
             fwCidrList = _fwCidrsDao.listByFirewallRuleId(rule.getId());
             if(fwCidrList != null){
-                if(fwCidrList.size()>1 || rule.getSourcePortEnd()!=port){
+                if (fwCidrList.size() > 1 || !rule.getSourcePortEnd().equals(port)) {
                     continue;
                 } else {
                     cidr = fwCidrList.get(0).getCidr();
@@ -414,7 +414,7 @@ public class BigSwitchBcfUtils {
                 Integer port = item.getSourcePortStart(); // currently BCF supports single port policy
                 aclCidrList = _aclItemCidrsDao.listByNetworkACLItemId(item.getId());
                 if(aclCidrList != null){
-                    if(aclCidrList.size()>1 || item.getSourcePortEnd()!=port){
+                    if (aclCidrList.size() > 1 || !item.getSourcePortEnd().equals(port)) {
                         continue;
                     } else {
                         cidr = aclCidrList.get(0).getCidr();


[21/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: pattern in used in split method

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/67719b1b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67719b1b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67719b1b

Branch: refs/heads/reporter
Commit: 67719b1be068c8e58e604fb3c255f946ed0c7d5c
Parents: 6f2fb92
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:57:20 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:57:20 2015 +0200

----------------------------------------------------------------------
 .../network/bigswitch/BigSwitchBcfUtils.java    |  4 +-
 .../bigswitch/BigSwitchBcfUtilsTest.java        | 74 ++++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67719b1b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
index 676275a..242089f 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
@@ -528,11 +528,13 @@ public class BigSwitchBcfUtils {
         }
     }
 
+    // returns null: should throw something^%*%#&
+    // Integer -> int
     public Integer getSubnetMaskLength(String maskString){
         if(!IPAddress.isValidIPv4(maskString)){
             return null;
         }
-        String[] octets = maskString.split(".");
+        String[] octets = maskString.split("\\.");
         Integer bits = 0;
         for (String o: octets){
             switch(o){

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67719b1b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
new file mode 100644
index 0000000..3433f8c
--- /dev/null
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
@@ -0,0 +1,74 @@
+package com.cloud.network.bigswitch;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.host.dao.HostDao;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.dao.BigSwitchBcfDao;
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.vpc.NetworkACLItemCidrsDao;
+import com.cloud.network.vpc.NetworkACLItemDao;
+import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+public class BigSwitchBcfUtilsTest {
+
+    @Mock
+    NetworkDao networkDao;
+    @Mock
+    NicDao nicDao;
+    @Mock
+    VMInstanceDao vmDao;
+    @Mock
+    HostDao hostDao;
+    @Mock
+    VpcDao vpcDao;
+    @Mock
+    BigSwitchBcfDao bigswitchBcfDao;
+    @Mock
+    AgentManager agentMgr;
+    @Mock
+    VlanDao vlanDao;
+    @Mock
+    IPAddressDao ipAddressDao;
+    @Mock
+    FirewallRulesDao fwRulesDao;
+    @Mock
+    FirewallRulesCidrsDao fwCidrsDao;
+    @Mock
+    NetworkACLItemDao aclItemDao;
+    @Mock
+    NetworkACLItemCidrsDao aclItemCidrsDao;
+    @Mock
+    NetworkModel networkModel;
+    @Mock
+    BigSwitchBcfUtils bsUtil;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        bsUtil = new BigSwitchBcfUtils(networkDao, nicDao, vmDao, hostDao,
+                vpcDao, bigswitchBcfDao, agentMgr, vlanDao, ipAddressDao,
+                fwRulesDao, fwCidrsDao, aclItemDao, aclItemCidrsDao,
+                networkModel);
+    }
+
+    @Test
+    public void getSubnetMaskLengthTest() {
+        Integer rc = bsUtil.getSubnetMaskLength("255.255.255.254");
+        assertEquals("failed", new Integer(31), rc);
+        rc = bsUtil.getSubnetMaskLength("128.255.255.254");
+        assertEquals("failed", new Integer(1), rc);
+    }
+}


[45/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
kvm: improve CentOS 7 support

CentOS 7 does not ship with ifconfig anymore. We should use ip commands instead.
This also works on older versions, like CentOS 6 and Ubuntu 12.x/14.x, that we
support.

This closes #165

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ac06ec02
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ac06ec02
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ac06ec02

Branch: refs/heads/reporter
Commit: ac06ec02eb442a4cc218b21e95f8d9a2a9ccb446
Parents: 30604e9
Author: Remi Bergsma <gi...@remi.nl>
Authored: Mon Apr 13 22:45:15 2015 -0500
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 14 16:51:14 2015 +0530

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java   | 4 ++--
 .../kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java  | 4 ++--
 .../kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ac06ec02/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
index 12eda74..aaf75ff 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
@@ -294,7 +294,7 @@ public class BridgeVifDriver extends VifDriverBase {
             }
         }
         if (!foundLinkLocalBr) {
-            Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
+            Script.runSimpleBashScript("ip address add 169.254.0.1/16 dev " + linkLocalBr + ";" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
                 NetUtils.getLinkLocalGateway());
         }
     }
@@ -302,7 +302,7 @@ public class BridgeVifDriver extends VifDriverBase {
     private void createControlNetwork(String privBrName) {
         deleteExitingLinkLocalRouteTable(privBrName);
         if (!isBridgeExists(privBrName)) {
-            Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout);
+            Script.runSimpleBashScript("brctl addbr " + privBrName + "; ip link set " + privBrName + " up; ip address add 169.254.0.1/16 dev " + privBrName, _timeout);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ac06ec02/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
index b503674..1aae2b5 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java
@@ -263,7 +263,7 @@ public class IvsVifDriver extends VifDriverBase {
             }
         }
         if (!foundLinkLocalBr) {
-            Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
+            Script.runSimpleBashScript("ip address add 169.254.0.1/16 dev " + linkLocalBr + ";" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
                 NetUtils.getLinkLocalGateway());
         }
     }
@@ -271,7 +271,7 @@ public class IvsVifDriver extends VifDriverBase {
     private void createControlNetwork(String privBrName) {
         deleteExitingLinkLocalRouteTable(privBrName);
         if (!isBridgeExists(privBrName)) {
-            Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout);
+            Script.runSimpleBashScript("brctl addbr " + privBrName + "; ip link set " + privBrName + " up; ip address add 169.254.0.1/16 dev " + privBrName, _timeout);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ac06ec02/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
index 1420682..6462df7 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
@@ -151,7 +151,7 @@ public class OvsVifDriver extends VifDriverBase {
             }
         }
         if (!foundLinkLocalBr) {
-            Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
+            Script.runSimpleBashScript("ip address add 169.254.0.1/16 dev " + linkLocalBr + ";" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " +
                     NetUtils.getLinkLocalGateway());
         }
     }
@@ -159,7 +159,7 @@ public class OvsVifDriver extends VifDriverBase {
     private void createControlNetwork(String privBrName) {
         deleteExitingLinkLocalRouteTable(privBrName);
         if (!isBridgeExists(privBrName)) {
-            Script.runSimpleBashScript("ovs-vsctl add-br " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout);
+            Script.runSimpleBashScript("ovs-vsctl add-br " + privBrName + "; ip link set " + privBrName + " up; ip address add 169.254.0.1/16 dev " + privBrName, _timeout);
         }
     }
 


[39/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Merge branch 'ui_domain_sort' of https://github.com/remibergsma/cloudstack


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cd67382b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cd67382b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cd67382b

Branch: refs/heads/reporter
Commit: cd67382b69caf436608b93bfb1c8446443f56d14
Parents: 8a5b1e6 a7f8059
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Mon Apr 13 07:10:39 2015 -0500
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Mon Apr 13 07:10:39 2015 -0500

----------------------------------------------------------------------
 ui/scripts/accounts.js        |  3 +++
 ui/scripts/accountsWizard.js  |  3 +++
 ui/scripts/configuration.js   |  9 +++++++++
 ui/scripts/events.js          |  3 +++
 ui/scripts/instances.js       |  6 ++++++
 ui/scripts/network.js         |  9 +++++++++
 ui/scripts/projects.js        |  3 +++
 ui/scripts/regions.js         |  3 +++
 ui/scripts/sharedFunctions.js |  3 +++
 ui/scripts/storage.js         |  6 ++++++
 ui/scripts/system.js          | 27 ++++++++++++++++++++++++---
 11 files changed, 72 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[25/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
rat: new license copy from sibling test class

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e459ccfa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e459ccfa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e459ccfa

Branch: refs/heads/reporter
Commit: e459ccfa6b5c21fe730642cf9fba1dcc5303587f
Parents: 951ffb1
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 19:56:00 2015 -0500
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 19:56:00 2015 -0500

----------------------------------------------------------------------
 .../test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e459ccfa/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
index 7bf5b12..554eac9 100644
--- a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchBcfUtilsTest.java
@@ -16,6 +16,7 @@
 // specific language governing permissions and limitations
 // under the License.
 //
+
 package com.cloud.network.bigswitch;
 
 import static org.junit.Assert.assertEquals;


[30/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
utils: improve timeout to 60s, define generics properly

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit d2471df0be35c9af928c682c961ac0544b347159)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/48ef7e5f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/48ef7e5f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/48ef7e5f

Branch: refs/heads/reporter
Commit: 48ef7e5f280b8eecfa59537cbb1b3d887517b8dc
Parents: 74e0a5f
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:31:42 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:45 2015 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/nio/Link.java                      | 2 +-
 utils/src/org/apache/cloudstack/utils/security/SSLUtils.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48ef7e5f/utils/src/com/cloud/utils/nio/Link.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/nio/Link.java b/utils/src/com/cloud/utils/nio/Link.java
index 971c253..ddfd474 100644
--- a/utils/src/com/cloud/utils/nio/Link.java
+++ b/utils/src/com/cloud/utils/nio/Link.java
@@ -466,7 +466,7 @@ public class Link {
         ByteBuffer out_pkgBuf = ByteBuffer.allocate(sslSession.getPacketBufferSize() + 40);
         ByteBuffer out_appBuf = ByteBuffer.allocate(sslSession.getApplicationBufferSize() + 40);
         int count;
-        ch.socket().setSoTimeout(30 * 1000);
+        ch.socket().setSoTimeout(60 * 1000);
         InputStream inStream = ch.socket().getInputStream();
         // Use readCh to make sure the timeout on reading is working
         ReadableByteChannel readCh = Channels.newChannel(inStream);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48ef7e5f/utils/src/org/apache/cloudstack/utils/security/SSLUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/security/SSLUtils.java b/utils/src/org/apache/cloudstack/utils/security/SSLUtils.java
index 5ea89b1..c1fc2d6 100644
--- a/utils/src/org/apache/cloudstack/utils/security/SSLUtils.java
+++ b/utils/src/org/apache/cloudstack/utils/security/SSLUtils.java
@@ -32,7 +32,7 @@ public class SSLUtils {
     public static final Logger s_logger = Logger.getLogger(SSLUtils.class);
 
     public static String[] getSupportedProtocols(String[] protocols) {
-        Set set = new HashSet();
+        Set<String> set = new HashSet<String>();
         for (String s : protocols) {
             if (s.equals("SSLv3") || s.equals("SSLv2Hello")) {
                 continue;


[02/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java b/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
new file mode 100644
index 0000000..c5407bc
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
@@ -0,0 +1,589 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.IAgentControl;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.UpdateBcfRouterCommand;
+import com.cloud.agent.api.BcfAnswer;
+import com.cloud.agent.api.CacheBcfTopologyCommand;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.CreateBcfRouterCommand;
+import com.cloud.agent.api.CreateBcfRouterInterfaceCommand;
+import com.cloud.agent.api.CreateBcfSegmentCommand;
+import com.cloud.agent.api.CreateBcfAttachmentCommand;
+import com.cloud.agent.api.CreateBcfStaticNatCommand;
+import com.cloud.agent.api.DeleteBcfSegmentCommand;
+import com.cloud.agent.api.DeleteBcfAttachmentCommand;
+import com.cloud.agent.api.DeleteBcfStaticNatCommand;
+import com.cloud.agent.api.GetControllerDataAnswer;
+import com.cloud.agent.api.GetControllerDataCommand;
+import com.cloud.agent.api.MaintainAnswer;
+import com.cloud.agent.api.MaintainCommand;
+import com.cloud.agent.api.PingCommand;
+import com.cloud.agent.api.ReadyAnswer;
+import com.cloud.agent.api.ReadyCommand;
+import com.cloud.agent.api.StartupBigSwitchBcfCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.SyncBcfTopologyCommand;
+import com.cloud.agent.api.UpdateBcfAttachmentCommand;
+import com.cloud.host.Host;
+import com.cloud.host.Host.Type;
+import com.cloud.network.bigswitch.AclData;
+import com.cloud.network.bigswitch.BigSwitchBcfApi;
+import com.cloud.network.bigswitch.BigSwitchBcfApiException;
+import com.cloud.network.bigswitch.Capabilities;
+import com.cloud.network.bigswitch.ControlClusterStatus;
+import com.cloud.network.bigswitch.ControllerData;
+import com.cloud.network.bigswitch.FloatingIpData;
+import com.cloud.network.bigswitch.NetworkData;
+import com.cloud.network.bigswitch.AttachmentData;
+import com.cloud.network.bigswitch.RouterData;
+import com.cloud.network.bigswitch.RouterInterfaceData;
+import com.cloud.network.bigswitch.TopologyData;
+import com.cloud.resource.ServerResource;
+import com.cloud.utils.component.ManagerBase;
+
+public class BigSwitchBcfResource extends ManagerBase implements ServerResource {
+    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfResource.class);
+
+    private String _name;
+    private String _guid;
+    private String _zoneId;
+    private int _numRetries;
+
+    private BigSwitchBcfApi _bigswitchBcfApi;
+    private TopologyData _latestTopology = null;
+    private boolean initTopologySyncDone = false;
+
+    protected BigSwitchBcfApi createBigSwitchBcfApi() {
+        return new BigSwitchBcfApi();
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+
+        _name = (String)params.get("name");
+        if (_name == null) {
+            throw new ConfigurationException("Unable to find name");
+        }
+
+        _guid = (String)params.get("guid");
+        if (_guid == null) {
+            throw new ConfigurationException("Unable to find the guid");
+        }
+
+        _zoneId = (String)params.get("zoneId");
+        if (_zoneId == null) {
+            throw new ConfigurationException("Unable to find zone");
+        }
+
+        _numRetries = 2;
+
+        String hostname = (String)params.get("hostname");
+        if (hostname == null) {
+            throw new ConfigurationException("Missing host name from params: " + params);
+        }
+
+        String username = (String) params.get("username");
+        if (username == null) {
+            throw new ConfigurationException("Missing user name from params: " + params);
+        }
+
+        String password = (String) params.get("password");
+        if (password == null) {
+            throw new ConfigurationException("Missing password from params: " + params);
+        }
+
+        Boolean nat = Boolean.parseBoolean((String) params.get("nat"));
+        if (nat == null) {
+            throw new ConfigurationException("Missing password from params: " + params);
+        }
+
+        _bigswitchBcfApi = createBigSwitchBcfApi();
+        _bigswitchBcfApi.setControllerAddress(hostname);
+        _bigswitchBcfApi.setControllerUsername(username);
+        _bigswitchBcfApi.setControllerPassword(password);
+        _bigswitchBcfApi.setControllerNat(nat);
+        _bigswitchBcfApi.setZoneId(_zoneId);
+
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        return true;
+    }
+
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+    @Override
+    public String getName() {
+        return _name;
+    }
+
+    @Override
+    public Type getType() {
+        return Host.Type.L2Networking;
+    }
+
+    @Override
+    public StartupCommand[] initialize() {
+        StartupBigSwitchBcfCommand sc = new StartupBigSwitchBcfCommand();
+        sc.setGuid(_guid);
+        sc.setName(_name);
+        sc.setDataCenter(_zoneId);
+        sc.setPod("");
+        sc.setPrivateIpAddress("");
+        sc.setStorageIpAddress("");
+        sc.setVersion("");
+        return new StartupCommand[] {sc};
+    }
+
+    @Override
+    public PingCommand getCurrentStatus(long id) {
+        if(!initTopologySyncDone && _latestTopology != null){
+            initTopologySyncDone = true;
+            if(_bigswitchBcfApi.isNatEnabled()){
+                try{
+                    executeRequest(new SyncBcfTopologyCommand(true, true), _numRetries);
+                } catch(Exception e){
+                    s_logger.error("BigSwitch BCF sync error", e);
+                }
+            } else {
+                try{
+                    executeRequest(new SyncBcfTopologyCommand(true, false), _numRetries);
+                } catch (Exception e){
+                    s_logger.error("BigSwitch BCF sync error", e);
+                }
+            }
+        }
+        try {
+            ControlClusterStatus ccs = _bigswitchBcfApi.getControlClusterStatus();
+            if (!ccs.getStatus()) {
+                s_logger.error("ControlCluster state is not ready: " + ccs.getStatus());
+                return null;
+            }
+            if (ccs.isTopologySyncRequested()) {
+                if(_latestTopology != null) {
+                    if(_bigswitchBcfApi.isNatEnabled()){
+                        executeRequest(new SyncBcfTopologyCommand(true, true), _numRetries);
+                    } else {
+                        executeRequest(new SyncBcfTopologyCommand(true, false), _numRetries);
+                    }
+                } else {
+                    s_logger.debug("topology sync needed but no topology history");
+                }
+            }
+        } catch (BigSwitchBcfApiException e) {
+            s_logger.error("getControlClusterStatus failed", e);
+            return null;
+        }
+        try {
+            Capabilities cap = _bigswitchBcfApi.getCapabilities();
+
+            // TODO: update controller status display, enable/disable service accordingly
+            if (cap.isTopologySyncRequested()) {
+                if(_latestTopology != null) {
+                    if(_bigswitchBcfApi.isNatEnabled()){
+                        executeRequest(new SyncBcfTopologyCommand(true, true), _numRetries);
+                    } else {
+                        executeRequest(new SyncBcfTopologyCommand(true, false), _numRetries);
+                    }
+                }
+            }
+
+        } catch (BigSwitchBcfApiException e) {
+            s_logger.error("getCapabilities failed", e);
+        }
+        return new PingCommand(Host.Type.L2Networking, id);
+    }
+
+    @Override
+    public Answer executeRequest(Command cmd) {
+        return executeRequest(cmd, _numRetries);
+    }
+
+    public Answer executeRequest(Command cmd, int numRetries) {
+        if (cmd instanceof ReadyCommand) {
+            return executeRequest((ReadyCommand)cmd);
+        } else if (cmd instanceof MaintainCommand) {
+            return executeRequest((MaintainCommand)cmd);
+        } else if (cmd instanceof CreateBcfSegmentCommand) {
+            _latestTopology = ((CreateBcfSegmentCommand) cmd).getTopology();
+            return executeRequest((CreateBcfSegmentCommand)cmd, numRetries);
+        } else if (cmd instanceof DeleteBcfSegmentCommand) {
+            _latestTopology = ((DeleteBcfSegmentCommand) cmd).getTopology();
+            return executeRequest((DeleteBcfSegmentCommand)cmd, numRetries);
+        } else if (cmd instanceof CreateBcfAttachmentCommand) {
+            _latestTopology = ((CreateBcfAttachmentCommand) cmd).getTopology();
+            return executeRequest((CreateBcfAttachmentCommand)cmd, numRetries);
+        } else if (cmd instanceof DeleteBcfAttachmentCommand) {
+            _latestTopology = ((DeleteBcfAttachmentCommand) cmd).getTopology();
+            return executeRequest((DeleteBcfAttachmentCommand)cmd, numRetries);
+        } else if (cmd instanceof UpdateBcfAttachmentCommand) {
+            _latestTopology = ((UpdateBcfAttachmentCommand) cmd).getTopology();
+            return executeRequest((UpdateBcfAttachmentCommand)cmd, numRetries);
+        } else if (cmd instanceof CreateBcfRouterCommand) {
+            _latestTopology = ((CreateBcfRouterCommand) cmd).getTopology();
+            return executeRequest((CreateBcfRouterCommand)cmd, numRetries);
+        } else if (cmd instanceof CreateBcfRouterInterfaceCommand) {
+            _latestTopology = ((CreateBcfRouterInterfaceCommand) cmd).getTopology();
+            return executeRequest((CreateBcfRouterInterfaceCommand)cmd, numRetries);
+        } else if (cmd instanceof CreateBcfStaticNatCommand) {
+            _latestTopology = ((CreateBcfStaticNatCommand) cmd).getTopology();
+            return executeRequest((CreateBcfStaticNatCommand)cmd, numRetries);
+        } else if (cmd instanceof DeleteBcfStaticNatCommand) {
+            _latestTopology = ((DeleteBcfStaticNatCommand) cmd).getTopology();
+            return executeRequest((DeleteBcfStaticNatCommand)cmd, numRetries);
+        } else if (cmd instanceof UpdateBcfRouterCommand) {
+            _latestTopology = ((UpdateBcfRouterCommand) cmd).getTopology();
+            return executeRequest((UpdateBcfRouterCommand)cmd, numRetries);
+        } else if (cmd instanceof SyncBcfTopologyCommand) {
+            return executeRequest((SyncBcfTopologyCommand)cmd, numRetries);
+        } else if (cmd instanceof CacheBcfTopologyCommand) {
+            return executeRequest((CacheBcfTopologyCommand)cmd, numRetries);
+        } else if (cmd instanceof GetControllerDataCommand) {
+            return executeRequest((GetControllerDataCommand)cmd, numRetries);
+        }
+        s_logger.debug("Received unsupported command " + cmd.toString());
+        return Answer.createUnsupportedCommandAnswer(cmd);
+    }
+
+    @Override
+    public void disconnected() {
+    }
+
+    @Override
+    public IAgentControl getAgentControl() {
+        return null;
+    }
+
+    @Override
+    public void setAgentControl(IAgentControl agentControl) {
+    }
+
+    public void setTopology(TopologyData topology){
+        _latestTopology = topology;
+    }
+
+    public TopologyData getTopology(){
+        return _latestTopology;
+    }
+
+    private Answer executeRequest(CreateBcfSegmentCommand cmd, int numRetries) {
+        NetworkData network = new NetworkData();
+        network.getNetwork().setTenantId(cmd.getTenantId());
+        network.getNetwork().setTenantName(cmd.getTenantName());
+        network.getNetwork().setId(cmd.getNetworkId());
+        network.getNetwork().setName(truncate("segment-cloudstack-" + cmd.getNetworkName(), 64));
+        network.getNetwork().setVlan(cmd.getVlan());
+
+        try {
+            String hash =_bigswitchBcfApi.createNetwork(network);
+            return new BcfAnswer(cmd, true, "Segment " + network.getNetwork().getId() + " created", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "Segment " + network.getNetwork().getId() + " created; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+
+    }
+
+    private Answer executeRequest(DeleteBcfSegmentCommand cmd, int numRetries) {
+        try {
+            String hash = _bigswitchBcfApi.deleteNetwork(cmd.get_tenantUuid(), cmd.getNetworkUuid());
+            return new BcfAnswer(cmd, true, "Segment " + cmd.getNetworkUuid() + " deleted", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "Segment " + cmd.getNetworkUuid() + " deleted; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(CreateBcfAttachmentCommand cmd, int numRetries) {
+        AttachmentData attachment = new AttachmentData();
+        attachment.getAttachment().setId(cmd.getNicId());
+        attachment.getAttachment().setHostId(cmd.getPortId());
+        attachment.getAttachment().setTenantName(cmd.getTenantName());
+        attachment.getAttachment().setVlan(cmd.getVlan());
+        attachment.getAttachment().addIpv4(cmd.getIpv4());
+        attachment.getAttachment().setMac(cmd.getMac());
+
+        try {
+            String hash = _bigswitchBcfApi.createAttachment(cmd.getTenantId(), cmd.getNetworkId(), attachment);
+            return new BcfAnswer(cmd, true, "network attachment " + cmd.getPortId() + " created", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "network attachment " + cmd.getPortId() + " created; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(DeleteBcfAttachmentCommand cmd, int numRetries) {
+        String nicName = cmd.getAttachmentId();
+        try {
+            String hash = _bigswitchBcfApi.deleteAttachment(cmd.getTenantId(), cmd.getNetworkId(), nicName);
+            return new BcfAnswer(cmd, true, "network attachment " + nicName + " deleted", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "network attachment " + nicName + " deleted; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(UpdateBcfAttachmentCommand cmd, int numRetries) {
+        AttachmentData attachment = new AttachmentData();
+        attachment.getAttachment().setId(cmd.getAttachmentId());
+        attachment.getAttachment().setTenantName(cmd.getTenantId());
+
+        try {
+            String hash = _bigswitchBcfApi.modifyAttachment(cmd.getTenantId(), cmd.getNetworkId(), attachment);
+            return new BcfAnswer(cmd, true, "Network attachment  " + cmd.getAttachmentId() + " updated", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "Network attachment  " + cmd.getAttachmentId() + " updated; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(CreateBcfStaticNatCommand cmd, int numRetries) {
+        FloatingIpData fip = new FloatingIpData();
+        fip.setTenantId(cmd.get_tenantId());
+        fip.setNetworkId(cmd.get_networkId());
+        fip.setFixedIp(cmd.get_privateIp());
+        fip.setFloatingIpAndId(cmd.get_publicIp());
+        fip.setMac(cmd.get_mac());
+
+        try {
+            String hash = _bigswitchBcfApi.createFloatingIp(cmd.get_tenantId(), fip);
+            return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + ":" +
+                    cmd.get_privateIp() + " created", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + ":" +
+                        cmd.get_privateIp() + " created; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(DeleteBcfStaticNatCommand cmd, int numRetries) {
+        try {
+            String hash = _bigswitchBcfApi.deleteFloatingIp(cmd.get_tenantId(), cmd.get_floatingIpId());
+            return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + " deleted", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + " deleted; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(CreateBcfRouterCommand cmd, int numRetries) {
+        RouterData router = new RouterData(cmd.get_tenantId());
+        try {
+            String hash;
+            hash = _bigswitchBcfApi.createRouter(cmd.get_tenantId(), router);
+
+            return new BcfAnswer(cmd, true, "router " + cmd.get_tenantId() +
+                    " created.", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, " created; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(CreateBcfRouterInterfaceCommand cmd, int numRetries) {
+        RouterInterfaceData routerInterface = new RouterInterfaceData(cmd.get_tenantId(),
+                cmd.get_gateway(), cmd.get_cidr(), cmd.get_networkId(), cmd.get_networkName());
+        try {
+            String hash;
+            hash = _bigswitchBcfApi.createRouterInterface(cmd.get_tenantId(),
+                    cmd.get_tenantId(), routerInterface);
+
+            return new BcfAnswer(cmd, true, "router " + cmd.get_tenantId() +
+                    " created.", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, " created; topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        }
+    }
+
+    private Answer executeRequest(UpdateBcfRouterCommand cmd, int numRetries){
+        RouterData routerData = new RouterData(cmd.getTenantId());
+
+        List<AclData> acls = new ArrayList<AclData>();
+        acls.addAll(cmd.getAcls());
+        routerData.getRouter().getAcls().addAll(acls);
+
+        routerData.getRouter().addExternalGateway(cmd.getPublicIp());
+
+        try {
+            String hash = _bigswitchBcfApi.modifyRouter(cmd.getTenantId(), routerData);
+            return new BcfAnswer(cmd, true, "tenant " + cmd.getTenantId() + " router updated", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (e.is_topologySyncRequested()) {
+                cmd.set_topologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "tenant " + cmd.getTenantId() + " router updated but topology sync required.");
+            } else {
+                if (numRetries > 0) {
+                    return retry(cmd, --numRetries);
+                } else {
+                    return new BcfAnswer(cmd, e);
+                }
+            }
+        } catch (IllegalArgumentException e1){
+            return new BcfAnswer(cmd, false, "Illegal argument in BCF router update");
+        }
+    }
+
+    private Answer executeRequest(SyncBcfTopologyCommand cmd, int numRetries) {
+        try {
+            TopologyData topo = _latestTopology;
+            if (!cmd.isNetworkIncluded()) {
+                topo.clearNetworks();
+            }
+            if(!cmd.isRouterIncluded()) {
+                topo.clearRouters();
+            }
+            String hash = _bigswitchBcfApi.syncTopology(topo);
+            if(!initTopologySyncDone){
+                initTopologySyncDone=true;
+            }
+            return new BcfAnswer(cmd, true, "BCF topology synced", hash);
+        } catch (BigSwitchBcfApiException e) {
+            if (numRetries > 0) {
+                return retry(cmd, --numRetries);
+            } else {
+                return new BcfAnswer(cmd, e);
+            }
+        } catch (IllegalArgumentException e1){
+            return new BcfAnswer(cmd, false, "Illegal argument in BCF topology sync");
+        }
+    }
+
+    private Answer executeRequest(CacheBcfTopologyCommand cmd, int numRetries) {
+        _latestTopology = cmd.getTopology();
+        return new Answer(cmd, true, "BCF topology cached");
+    }
+
+    private Answer executeRequest(GetControllerDataCommand cmd, int numRetries) {
+        ControllerData controller = _bigswitchBcfApi.getControllerData();
+        return new GetControllerDataAnswer(cmd,
+                controller.getIpAddress(),
+                controller.isMaster());
+    }
+
+    private Answer executeRequest(ReadyCommand cmd) {
+        return new ReadyAnswer(cmd);
+    }
+
+    private Answer executeRequest(MaintainCommand cmd) {
+        return new MaintainAnswer(cmd);
+    }
+
+    private Answer retry(Command cmd, int numRetries) {
+        s_logger.warn("Retrying " + cmd.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries);
+        return executeRequest(cmd, numRetries);
+    }
+
+    private String truncate(String string, int length) {
+        if (string.length() <= length) {
+            return string;
+        } else {
+            return string.substring(0, length);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchApiTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
new file mode 100644
index 0000000..5d40e5d
--- /dev/null
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
@@ -0,0 +1,433 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.UUID;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.params.HttpClientParams;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gson.reflect.TypeToken;
+
+public class BigSwitchApiTest {
+    BigSwitchBcfApi _api;
+    HttpClient _client = mock(HttpClient.class);
+    HttpMethod _method;
+
+    @Before
+    public void setUp() {
+        HttpClientParams hmp = mock(HttpClientParams.class);
+        when(_client.getParams()).thenReturn(hmp);
+        _api = new BigSwitchBcfApi(){
+            @Override
+            protected HttpClient createHttpClient() {
+                return _client;
+            }
+
+            @Override
+            protected HttpMethod createMethod(String type, String uri, int port) {
+                return _method;
+            }
+        };
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithoutHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress(null);
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithEmptyHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithoutUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername(null);
+        _api.setControllerPassword("mypassword");
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithEmptyUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("");
+        _api.setControllerPassword("mypassword");
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithoutPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword(null);
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectWithEmptyPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("");
+        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithoutHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress(null);
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithEmptyHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithoutUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername(null);
+        _api.setControllerPassword("mypassword");
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithEmptyUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("");
+        _api.setControllerPassword("mypassword");
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithoutPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword(null);
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectWithEmptyPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("");
+        _api.executeCreateObject(new String(), "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithoutHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress(null);
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeDeleteObject("/");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithEmptyHostname() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("mypassword");
+        _api.executeDeleteObject("/");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithoutUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername(null);
+        _api.setControllerPassword("mypassword");
+        _api.executeDeleteObject("/");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithEmptyUsername() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("");
+        _api.setControllerPassword("mypassword");
+        _api.executeDeleteObject("/");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithoutPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword(null);
+        _api.executeDeleteObject("/");
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectWithEmptyPassword() throws BigSwitchBcfApiException {
+        _api.setControllerAddress("10.10.0.10");
+        _api.setControllerUsername("myname");
+        _api.setControllerPassword("");
+        _api.executeDeleteObject("/");
+    }
+
+    @Test
+    public void executeMethodTestOK() throws BigSwitchBcfApiException, HttpException, IOException {
+        GetMethod gm = mock(GetMethod.class);
+        when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        _api.executeMethod(gm);
+        verify(gm, times(1)).getStatusCode();
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void executeMethodTestUnauthorized() throws BigSwitchBcfApiException, IOException {
+        GetMethod gm = mock(GetMethod.class);
+        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
+        when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED);
+        _api.executeMethod(gm);
+    }
+
+    @Test
+    public void testExecuteCreateObjectOK() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PostMethod.class);
+        when(_method.getResponseHeader("X-BSN-BVS-HASH-MATCH")).thenReturn(new Header("X-BSN-BVS-HASH-MATCH", UUID.randomUUID().toString()));
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        String hash = _api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);assertNotEquals(hash, "");
+        assertNotEquals(hash, BigSwitchBcfApi.HASH_CONFLICT);
+        assertNotEquals(hash, BigSwitchBcfApi.HASH_IGNORE);
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectConflict() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PostMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_CONFLICT);
+        _api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test
+    public void testExecuteCreateObjectSlave() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PostMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_SEE_OTHER);
+        String hash = _api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
+        assertEquals(hash, BigSwitchBcfApi.HASH_IGNORE);
+        assertEquals(_api.getControllerData().isMaster(), false);
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectFailure() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PostMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        Header header = mock(Header.class);
+        when(header.getValue()).thenReturn("text/html");
+        when(_method.getResponseHeader("Content-type")).thenReturn(header);
+        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(_method.isRequestSent()).thenReturn(true);
+        try {
+            _api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteCreateObjectException() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
+        _method = mock(PostMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        Header header = mock(Header.class);
+        when(header.getValue()).thenReturn("text/html");
+        when(_method.getResponseHeader("Content-type")).thenReturn(header);
+        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        try {
+            _api.executeCreateObject(network, "/", Collections.<String, String> emptyMap());
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test
+    public void testExecuteUpdateObjectOK() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PutMethod.class);
+        when(_method.getResponseHeader("X-BSN-BVS-HASH-MATCH")).thenReturn(new Header("X-BSN-BVS-HASH-MATCH", UUID.randomUUID().toString()));
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        String hash = _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);
+        assertNotEquals(hash, "");
+        assertNotEquals(hash, BigSwitchBcfApi.HASH_CONFLICT);
+        assertNotEquals(hash, BigSwitchBcfApi.HASH_IGNORE);
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectConflict() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PutMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_CONFLICT);
+        _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
+    }
+
+    @Test
+    public void testExecuteUpdateObjectSlave() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PutMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_SEE_OTHER);
+        String hash = _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
+        assertEquals(hash, BigSwitchBcfApi.HASH_IGNORE);
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectFailure() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PutMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        Header header = mock(Header.class);
+        when(header.getValue()).thenReturn("text/html");
+        when(_method.getResponseHeader("Content-type")).thenReturn(header);
+        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(_method.isRequestSent()).thenReturn(true);
+        try {
+            _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteUpdateObjectException() throws BigSwitchBcfApiException, IOException {
+        NetworkData network = new NetworkData();
+        _method = mock(PutMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(_client.executeMethod((HttpMethod)any())).thenThrow(new IOException());
+        try {
+            _api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test
+    public void testExecuteDeleteObject() throws BigSwitchBcfApiException, IOException {
+        _method = mock(DeleteMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        _api.executeDeleteObject("/");
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectFailure() throws BigSwitchBcfApiException, IOException {
+        _method = mock(DeleteMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        Header header = mock(Header.class);
+        when(header.getValue()).thenReturn("text/html");
+        when(_method.getResponseHeader("Content-type")).thenReturn(header);
+        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(_method.isRequestSent()).thenReturn(true);
+        try {
+            _api.executeDeleteObject("/");
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test(expected = BigSwitchBcfApiException.class)
+    public void testExecuteDeleteObjectException() throws BigSwitchBcfApiException, IOException {
+        _method = mock(DeleteMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
+        try {
+            _api.executeDeleteObject("/");
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
+    @Test
+    public void testExecuteRetrieveControllerMasterStatus() throws BigSwitchBcfApiException, IOException {
+        _method = mock(GetMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(((HttpMethodBase)_method).getResponseBodyAsString(2048)).thenReturn("{'healthy': true, 'topologySyncRequested': false}");
+        _api.executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
+        }.getType(), "/", null);
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);
+        assertEquals(_api.getControllerData().isMaster(), true);
+    }
+
+    @Test
+    public void testExecuteRetrieveControllerMasterStatusWithTopoConflict() throws BigSwitchBcfApiException, IOException {
+        _method = mock(GetMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_CONFLICT);
+        when(((HttpMethodBase)_method).getResponseBodyAsString(2048)).thenReturn("{'healthy': true, 'topologySyncRequested': true}");
+        _api.executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
+        }.getType(), "/", null);
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);
+        assertEquals(_api.getControllerData().isMaster(), true);
+    }
+
+    @Test
+    public void testExecuteRetrieveControllerSlaveStatus() throws BigSwitchBcfApiException, IOException {
+        _method = mock(GetMethod.class);
+        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_SEE_OTHER);
+        when(((HttpMethodBase)_method).getResponseBodyAsString(1024)).thenReturn("{'healthy': true, 'topologySyncRequested': false}");
+        _api.executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
+        }.getType(), "/", null);
+        verify(_method, times(1)).releaseConnection();
+        verify(_client, times(1)).executeMethod(_method);
+        assertEquals(_api.getControllerData().isMaster(), false);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/test/com/cloud/network/resource/BigSwitchBcfResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/test/com/cloud/network/resource/BigSwitchBcfResourceTest.java b/plugins/network-elements/bigswitch/test/com/cloud/network/resource/BigSwitchBcfResourceTest.java
new file mode 100644
index 0000000..005e2f6
--- /dev/null
+++ b/plugins/network-elements/bigswitch/test/com/cloud/network/resource/BigSwitchBcfResourceTest.java
@@ -0,0 +1,431 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.resource;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.naming.ConfigurationException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.cloud.agent.api.BcfAnswer;
+import com.cloud.agent.api.CreateBcfRouterCommand;
+import com.cloud.agent.api.CreateBcfSegmentCommand;
+import com.cloud.agent.api.CreateBcfAttachmentCommand;
+import com.cloud.agent.api.CreateBcfStaticNatCommand;
+import com.cloud.agent.api.DeleteBcfSegmentCommand;
+import com.cloud.agent.api.DeleteBcfAttachmentCommand;
+import com.cloud.agent.api.DeleteBcfStaticNatCommand;
+import com.cloud.agent.api.PingCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.SyncBcfTopologyCommand;
+import com.cloud.agent.api.UpdateBcfAttachmentCommand;
+import com.cloud.agent.api.UpdateBcfRouterCommand;
+import com.cloud.host.Host;
+import com.cloud.network.bigswitch.BigSwitchBcfApi;
+import com.cloud.network.bigswitch.BigSwitchBcfApiException;
+import com.cloud.network.bigswitch.Capabilities;
+import com.cloud.network.bigswitch.ControlClusterStatus;
+import com.cloud.network.bigswitch.FloatingIpData;
+import com.cloud.network.bigswitch.NetworkData;
+import com.cloud.network.bigswitch.AttachmentData;
+import com.cloud.network.bigswitch.RouterData;
+import com.cloud.network.bigswitch.TopologyData;
+
+public class BigSwitchBcfResourceTest {
+    BigSwitchBcfApi _bigswitchBcfApi = mock(BigSwitchBcfApi.class);
+    BigSwitchBcfResource _resource;
+    Map<String, Object> _parameters;
+
+    String bcfAddress = "127.0.0.1";
+    String bcfUserName = "myname";
+    String bcfPassword = "mypassword";
+
+    @Before
+    public void setUp() throws ConfigurationException {
+        _resource = new BigSwitchBcfResource() {
+            @Override
+            protected BigSwitchBcfApi createBigSwitchBcfApi() {
+                return _bigswitchBcfApi;
+            }
+        };
+
+        _parameters = new HashMap<String, Object>();
+        _parameters.put("name", "bigswitchbcftestdevice");
+        _parameters.put("hostname", bcfAddress);
+        _parameters.put("guid", "aaaaa-bbbbb-ccccc");
+        _parameters.put("zoneId", "blublub");
+        _parameters.put("username", bcfUserName);
+        _parameters.put("password", bcfPassword);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void resourceConfigureFailure() throws ConfigurationException {
+        _resource.configure("BigSwitchBcfResource", Collections.<String, Object> emptyMap());
+    }
+
+    @Test
+    public void resourceConfigure() throws ConfigurationException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        verify(_bigswitchBcfApi).setControllerAddress(bcfAddress);
+        verify(_bigswitchBcfApi).setControllerUsername(bcfUserName);
+        verify(_bigswitchBcfApi).setControllerPassword(bcfPassword);
+
+        assertTrue("bigswitchbcftestdevice".equals(_resource.getName()));
+
+        /* Pretty lame test, but here to assure this plugin fails
+         * if the type name ever changes from L2Networking
+         */
+        assertTrue(_resource.getType() == Host.Type.L2Networking);
+    }
+
+    @Test
+    public void testInitialization() throws ConfigurationException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        StartupCommand[] sc = _resource.initialize();
+        assertTrue(sc.length == 1);
+        assertTrue("aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
+        assertTrue("bigswitchbcftestdevice".equals(sc[0].getName()));
+        assertTrue("blublub".equals(sc[0].getDataCenter()));
+    }
+
+    @Test
+    public void testPingCommandStatusOk() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
+        when(ccs.getStatus()).thenReturn(true);
+        when(_bigswitchBcfApi.getControlClusterStatus()).thenReturn(ccs);
+
+        Capabilities cap = mock(Capabilities.class);
+        when(_bigswitchBcfApi.getCapabilities()).thenReturn(cap);
+
+        PingCommand ping = _resource.getCurrentStatus(42);
+        assertTrue(ping != null);
+        assertTrue(ping.getHostId() == 42);
+        assertTrue(ping.getHostType() == Host.Type.L2Networking);
+    }
+
+    @Test
+    public void testPingCommandStatusFail() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
+        when(ccs.getStatus()).thenReturn(false);
+        when(_bigswitchBcfApi.getControlClusterStatus()).thenReturn(ccs);
+
+        PingCommand ping = _resource.getCurrentStatus(42);
+        assertTrue(ping == null);
+    }
+
+    @Test
+    public void testPingCommandStatusApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        ControlClusterStatus ccs = mock(ControlClusterStatus.class);
+        when(ccs.getStatus()).thenReturn(false);
+        when(_bigswitchBcfApi.getControlClusterStatus()).thenThrow(new BigSwitchBcfApiException());
+
+        PingCommand ping = _resource.getCurrentStatus(42);
+        assertTrue(ping == null);
+    }
+
+    @Test
+    public void testCreateNetworkRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        NetworkData networkdata = mock(NetworkData.class);
+        NetworkData.Network network = mock(NetworkData.Network.class);
+        when(networkdata.getNetwork()).thenReturn(network);
+        when(network.getId()).thenReturn("cccc");
+        when(_bigswitchBcfApi.createNetwork((NetworkData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        CreateBcfSegmentCommand cmd = new CreateBcfSegmentCommand("tenantid", "tenantname",
+                (String)_parameters.get("guid"), "networkName", 0);
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        NetworkData networkdata = mock(NetworkData.class);
+        NetworkData.Network network = mock(NetworkData.Network.class);
+        when(networkdata.getNetwork()).thenReturn(network);
+        when(network.getId()).thenReturn("cccc");
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createNetwork((NetworkData)any());
+
+        CreateBcfSegmentCommand cmd = new CreateBcfSegmentCommand("tenantid", "tenantname",
+                (String)_parameters.get("guid"), "networkName", 0);
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).createNetwork((NetworkData)any());
+    }
+
+    @Test
+    public void testDeleteNetworkRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+        when(_bigswitchBcfApi.deleteNetwork((String)any(), (String)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand("tenantid", "networkid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testDeleteNetworkApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteNetwork((String)any(), (String)any());
+
+        DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand("tenantid", "networkid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).deleteNetwork((String)any(), (String)any());
+    }
+
+    @Test
+    public void testCreateAttachmentRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        AttachmentData attachmentData = mock(AttachmentData.class);
+        AttachmentData.Attachment attachment = mock(AttachmentData.Attachment.class);
+        when(attachmentData.getAttachment()).thenReturn(attachment);
+        when(attachment.getId()).thenReturn("eeee");
+        when(_bigswitchBcfApi.createAttachment((String)any(), (String)any(), (AttachmentData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        CreateBcfAttachmentCommand cmd = new CreateBcfAttachmentCommand("tenantid", "tenantname",
+                "networkid", "portid", "nicId", 100, "1.2.3.4", "aa:bb:cc:dd:ee:ff");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testCreateAttachmentApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        AttachmentData attachmentData = mock(AttachmentData.class);
+        AttachmentData.Attachment attachment = mock(AttachmentData.Attachment.class);
+        when(attachmentData.getAttachment()).thenReturn(attachment);
+        when(attachment.getId()).thenReturn("eeee");
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createAttachment((String)any(), (String)any(), (AttachmentData)any());
+
+        CreateBcfAttachmentCommand cmd = new CreateBcfAttachmentCommand("tenantid", "tenantname",
+                "networkid", "portid", "nicId", 100, "1.2.3.4", "aa:bb:cc:dd:ee:ff");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).createAttachment((String)any(), (String)any(), (AttachmentData)any());
+    }
+
+    @Test
+    public void testDeleteAttachmentRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.deleteAttachment((String)any(), (String)any(), (String)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(new DeleteBcfAttachmentCommand("networkId", "portid", "tenantid"));
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testDeleteAttachmentException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteAttachment((String)any(), (String)any(), (String)any());
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(new DeleteBcfAttachmentCommand("networkId", "portid", "tenantid"));
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).deleteAttachment((String)any(), (String)any(), (String)any());
+    }
+
+    @Test
+    public void testUpdateAttachmentRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.modifyAttachment((String)any(), (String)any(), (AttachmentData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(new UpdateBcfAttachmentCommand("networkId", "portId", "tenantId", "portname"));
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testUpdateAttachmentException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).modifyAttachment((String)any(), (String)any(), (AttachmentData)any());
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(new UpdateBcfAttachmentCommand("networkId", "portId", "tenantId", "portname"));
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).modifyAttachment((String)any(), (String)any(), (AttachmentData)any());
+    }
+
+    @Test
+    public void testCreateStaticNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.createFloatingIp((String)any(), (FloatingIpData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        CreateBcfStaticNatCommand cmd = new CreateBcfStaticNatCommand("tenantid",
+                "networkid", "192.168.0.10", "10.4.4.100", "90:b1:1c:49:d8:56");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testCreateStaticNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createFloatingIp((String)any(), (FloatingIpData)any());
+
+        CreateBcfStaticNatCommand cmd = new CreateBcfStaticNatCommand("tenantid",
+                "networkid", "192.168.0.10", "10.4.4.100", "90:b1:1c:49:d8:56");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).createFloatingIp((String)any(), (FloatingIpData)any());
+    }
+
+    @Test
+    public void testDeleteStaticNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.deleteFloatingIp((String)any(), (String)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        DeleteBcfStaticNatCommand cmd = new DeleteBcfStaticNatCommand("tenantid",
+                "10.4.4.100");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testDeleteStaticNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteFloatingIp((String)any(), (String)any());
+
+        DeleteBcfStaticNatCommand cmd = new DeleteBcfStaticNatCommand("tenantid",
+                "10.4.4.100");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).deleteFloatingIp((String)any(), (String)any());
+    }
+
+    @Test
+    public void testCreateRouterRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.createRouter((String)any(), (RouterData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        CreateBcfRouterCommand cmd = new CreateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testCreateRouterApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createRouter((String)any(), (RouterData)any());
+
+        CreateBcfRouterCommand cmd = new CreateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).createRouter((String)any(), (RouterData)any());
+    }
+
+    @Test
+    public void testCreateSourceNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.modifyRouter((String)any(), (RouterData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testCreateSourceNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).modifyRouter((String)any(), (RouterData)any());
+
+        UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).modifyRouter((String)any(), (RouterData)any());
+    }
+
+    @Test
+    public void testDeleteSourceNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        when(_bigswitchBcfApi.modifyRouter((String)any(), (RouterData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+
+        UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertTrue(ans.getResult());
+    }
+
+    @Test
+    public void testDeleteSourceNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+
+        doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).modifyRouter((String)any(), (RouterData)any());
+
+        UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd);
+        assertFalse(ans.getResult());
+        verify(_bigswitchBcfApi, times(3)).modifyRouter((String)any(), (RouterData)any());
+    }
+
+    @Test
+    public void testSyncTopologyRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
+        _resource.configure("BigSwitchBcfResource", _parameters);
+        _resource.setTopology(new TopologyData());
+
+        when(_bigswitchBcfApi.syncTopology((TopologyData)any())).thenThrow(new BigSwitchBcfApiException())
+        .thenReturn(UUID.randomUUID().toString());
+        BcfAnswer ans = (BcfAnswer)_resource.executeRequest(new SyncBcfTopologyCommand(true, false));
+        assertTrue(ans.getResult());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index ccda955..a547e1e 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -65,7 +65,7 @@
     <module>network-elements/palo-alto</module>
     <module>network-elements/netscaler</module>
     <module>network-elements/nicira-nvp</module>
-    <module>network-elements/bigswitch-vns</module>
+    <module>network-elements/bigswitch</module>
     <module>network-elements/brocade-vcs</module>
     <module>network-elements/midonet</module>
     <module>network-elements/stratosphere-ssp</module>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/scripts/util/qemu-ivs-ifup
----------------------------------------------------------------------
diff --git a/scripts/util/qemu-ivs-ifup b/scripts/util/qemu-ivs-ifup
new file mode 100755
index 0000000..6830d23
--- /dev/null
+++ b/scripts/util/qemu-ivs-ifup
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/sbin/ifconfig $1 0.0.0.0 up
+/usr/sbin/ivs-ctl add-port $1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 65d9a21..ef4c19a 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -2401,7 +2401,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         for (Network.Provider serviceProvider : serviceProviders) {
             // return only Virtual Router/JuniperSRX/CiscoVnmc as a provider for the firewall
             if (service == Service.Firewall
-                    && !(serviceProvider == Provider.VirtualRouter || serviceProvider == Provider.JuniperSRX || serviceProvider == Provider.CiscoVnmc || serviceProvider == Provider.PaloAlto || serviceProvider == Provider.NuageVsp)) {
+                    && !(serviceProvider == Provider.VirtualRouter || serviceProvider == Provider.JuniperSRX || serviceProvider == Provider.CiscoVnmc || serviceProvider == Provider.PaloAlto || serviceProvider == Provider.NuageVsp || serviceProvider == Provider.BigSwitchBcf)) {
                 continue;
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 39e0c1b..1ec531a 100644
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -1406,7 +1406,14 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
             throw new InvalidParameterValueException("Vm ip is not set as dnat ip for this public ip");
         }
 
-        StaticNatImpl staticNat = new StaticNatImpl(sourceIp.getAllocatedToAccountId(), sourceIp.getAllocatedInDomainId(), networkId, sourceIp.getId(), dstIp, forRevoke);
+        String srcMac = null;
+        try {
+            srcMac = _networkModel.getNextAvailableMacAddressInNetwork(networkId);
+        } catch (InsufficientAddressCapacityException e) {
+            throw new CloudRuntimeException("Insufficient MAC address for static NAT instantiation.");
+        }
+
+        StaticNatImpl staticNat = new StaticNatImpl(sourceIp.getAllocatedToAccountId(), sourceIp.getAllocatedInDomainId(), networkId, sourceIp.getId(), dstIp, srcMac, forRevoke);
         staticNats.add(staticNat);
         return staticNats;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/server/src/com/cloud/network/rules/StaticNatImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/StaticNatImpl.java b/server/src/com/cloud/network/rules/StaticNatImpl.java
index 49e9b78..f07b45e 100644
--- a/server/src/com/cloud/network/rules/StaticNatImpl.java
+++ b/server/src/com/cloud/network/rules/StaticNatImpl.java
@@ -22,6 +22,7 @@ public class StaticNatImpl implements StaticNat {
     long networkId;
     long sourceIpAddressId;
     String destIpAddress;
+    String sourceMacAddress;
     boolean forRevoke;
 
     public StaticNatImpl(long accountId, long domainId, long networkId, long sourceIpAddressId, String destIpAddress, boolean forRevoke) {
@@ -31,6 +32,18 @@ public class StaticNatImpl implements StaticNat {
         this.networkId = networkId;
         this.sourceIpAddressId = sourceIpAddressId;
         this.destIpAddress = destIpAddress;
+        this.sourceMacAddress = null;
+        this.forRevoke = forRevoke;
+    }
+
+    public StaticNatImpl(long accountId, long domainId, long networkId, long sourceIpAddressId, String destIpAddress, String sourceMacAddress, boolean forRevoke) {
+        super();
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.networkId = networkId;
+        this.sourceIpAddressId = sourceIpAddressId;
+        this.destIpAddress = destIpAddress;
+        this.sourceMacAddress = sourceMacAddress;
         this.forRevoke = forRevoke;
     }
 
@@ -60,6 +73,11 @@ public class StaticNatImpl implements StaticNat {
     }
 
     @Override
+    public String getSourceMacAddress() {
+        return sourceMacAddress;
+    }
+
+    @Override
     public boolean isForRevoke() {
         return forRevoke;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index abd779b..2a07895 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -224,7 +224,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
     private final List<Service> nonSupportedServices = Arrays.asList(Service.SecurityGroup, Service.Firewall);
     private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter,
             Provider.NiciraNvp, Provider.InternalLbVm, Provider.Netscaler, Provider.JuniperContrailVpcRouter,
-            Provider.Ovs, Provider.NuageVsp);
+            Provider.Ovs, Provider.NuageVsp, Provider.BigSwitchBcf);
 
     int _cleanupInterval;
     int _maxNetworks;
@@ -2431,4 +2431,4 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         final StaticRoute route = _staticRouteDao.findById(routeId);
         return applyStaticRoutesForVpc(route.getVpcId());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index b4786c0..7665aec 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -150,6 +150,7 @@ DROP TABLE IF EXISTS `cloud`.`nicira_nvp_nic_map`;
 DROP TABLE IF EXISTS `cloud`.`s3`;
 DROP TABLE IF EXISTS `cloud`.`template_s3_ref`;
 DROP TABLE IF EXISTS `cloud`.`nicira_nvp_router_map`;
+DROP TABLE IF EXISTS `cloud`.`external_bigswitch_bcf_devices`;
 DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`;
 DROP TABLE IF EXISTS `cloud`.`autoscale_vmgroup_policy_map`;
 DROP TABLE IF EXISTS `cloud`.`autoscale_vmgroup_vm_map`;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index 4a8f250..5dee6c6 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -284,6 +284,24 @@ CREATE TABLE `cloud`.`brocade_network_vlan_map` (
    CONSTRAINT `fk_brocade_network_vlan_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`;
+CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
+  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `uuid` varchar(255) UNIQUE,
+  `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added',
+  `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch bcf device',
+  `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch bcf device',
+  `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch bcf device',
+  `hostname` varchar(255) NOT NULL COMMENT 'host name or IP address for the bigswitch bcf device',
+  `username` varchar(255) NOT NULL COMMENT 'username for the bigswitch bcf device',
+  `password` varchar(255) NOT NULL COMMENT 'password for the bigswitch bcf device',
+  `nat` boolean NOT NULL COMMENT 'NAT support for the bigswitch bcf device',
+  `hash` varchar(255) NOT NULL COMMENT 'topology hash for the bigswitch bcf networks',
+  PRIMARY KEY  (`id`),
+  CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
+  CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 /* As part of the separation of Xen and XenServer, update the column for the network labels */
 ALTER TABLE `cloud`.`physical_network_traffic_types` CHANGE `xen_network_label` `xenserver_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a XenServer host';
 


[35/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
kvm: xml escape password

(cherry picked from commit 13de2691fddb4b755605ee44ac0e95dedb26987d)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>

Conflicts:
	plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ccf13ec0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ccf13ec0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ccf13ec0

Branch: refs/heads/reporter
Commit: ccf13ec04eb1f04ca35a99cdb9d53e838b3148ed
Parents: 7949d29
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 16:04:40 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 16:10:42 2015 +0530

----------------------------------------------------------------------
 .../kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ccf13ec0/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index b5723ed..5c8d337 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.hypervisor.kvm.resource;
 
+import org.apache.commons.lang.StringEscapeUtils;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -1168,7 +1170,7 @@ public class LibvirtVMDef {
             _port = port;
             _autoPort = autoPort;
             _listenAddr = listenAddr;
-            _passwd = passwd;
+            _passwd = StringEscapeUtils.escapeXml(passwd);
             _keyMap = keyMap;
         }
 


[08/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
db: move bigswitch related sqls to schema-451to460.sql

We ought not change older schema migrations, so moved sql statements to the latest
upgrade path.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/770297e8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/770297e8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/770297e8

Branch: refs/heads/reporter
Commit: 770297e8cb14fea4dae2f5f0bfd8aaefa8ea0aa3
Parents: 01864ef
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Apr 9 13:00:08 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Apr 9 13:15:02 2015 +0530

----------------------------------------------------------------------
 setup/db/db/schema-442to450.sql | 18 ------------------
 setup/db/db/schema-451to460.sql | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770297e8/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index 5dee6c6..4a8f250 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -284,24 +284,6 @@ CREATE TABLE `cloud`.`brocade_network_vlan_map` (
    CONSTRAINT `fk_brocade_network_vlan_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`;
-CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
-  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
-  `uuid` varchar(255) UNIQUE,
-  `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added',
-  `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch bcf device',
-  `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch bcf device',
-  `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch bcf device',
-  `hostname` varchar(255) NOT NULL COMMENT 'host name or IP address for the bigswitch bcf device',
-  `username` varchar(255) NOT NULL COMMENT 'username for the bigswitch bcf device',
-  `password` varchar(255) NOT NULL COMMENT 'password for the bigswitch bcf device',
-  `nat` boolean NOT NULL COMMENT 'NAT support for the bigswitch bcf device',
-  `hash` varchar(255) NOT NULL COMMENT 'topology hash for the bigswitch bcf networks',
-  PRIMARY KEY  (`id`),
-  CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
-  CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
 /* As part of the separation of Xen and XenServer, update the column for the network labels */
 ALTER TABLE `cloud`.`physical_network_traffic_types` CHANGE `xen_network_label` `xenserver_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a XenServer host';
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770297e8/setup/db/db/schema-451to460.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-451to460.sql b/setup/db/db/schema-451to460.sql
index 6674a51..0abd4f8 100644
--- a/setup/db/db/schema-451to460.sql
+++ b/setup/db/db/schema-451to460.sql
@@ -380,3 +380,21 @@ INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`,
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.template.ovm3', 'SystemVM Template (Ovm3)', 'Name of the default router template on Ovm3.','SystemVM Template (Ovm3)', NULL, NULL, 0);
 
 UPDATE IGNORE `cloud`.`configuration` SET `value`="PLAINTEXT" WHERE `name`="user.authenticators.exclude";
+
+DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`;
+CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
+  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `uuid` varchar(255) UNIQUE,
+  `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added',
+  `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch bcf device',
+  `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch bcf device',
+  `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch bcf device',
+  `hostname` varchar(255) NOT NULL COMMENT 'host name or IP address for the bigswitch bcf device',
+  `username` varchar(255) NOT NULL COMMENT 'username for the bigswitch bcf device',
+  `password` varchar(255) NOT NULL COMMENT 'password for the bigswitch bcf device',
+  `nat` boolean NOT NULL COMMENT 'NAT support for the bigswitch bcf device',
+  `hash` varchar(255) NOT NULL COMMENT 'topology hash for the bigswitch bcf networks',
+  PRIMARY KEY  (`id`),
+  CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
+  CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;


[47/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8374: Adding tests for guest traffic port group verification - Shared and Isolated networks


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9777e905
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9777e905
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9777e905

Branch: refs/heads/reporter
Commit: 9777e90504841b4fd95ba87edade707fec66dc89
Parents: c0d3e6f
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Apr 14 13:22:07 2015 +0530
Committer: Gaurav Aradhye <ga...@clogeny.com>
Committed: Tue Apr 14 18:17:17 2015 +0530

----------------------------------------------------------------------
 .../component/test_shared_networks.py           | 79 +++++++++++++++++++-
 test/integration/smoke/test_network.py          | 18 ++++-
 2 files changed, 94 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9777e905/test/integration/component/test_shared_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py
index dde5983..3b21d8d 100644
--- a/test/integration/component/test_shared_networks.py
+++ b/test/integration/component/test_shared_networks.py
@@ -40,7 +40,8 @@ from marvin.lib.common import (get_domain,
                                get_template,
                                get_free_vlan,
                                wait_for_cleanup,
-                               verifyRouterState)
+                               verifyRouterState,
+                               verifyGuestTrafficPortGroups)
 from marvin.sshClient import SshClient
 from marvin.codes import PASS
 from ddt import ddt, data
@@ -61,6 +62,7 @@ class TestSharedNetworks(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.template = get_template(
             cls.api_client,
             cls.zone.id,
@@ -3672,3 +3674,78 @@ class TestSharedNetworks(cloudstackTestCase):
             "Check if disassociated IP Address is no longer available"
         )
         return
+
+    @attr(tags=["advanced", "dvs"], required_hardware="true")
+    def test_guest_traffic_port_groups_shared_network(self):
+        """ Verify vcenter port groups are created for shared network
+
+        # Steps,
+        #  1. Create a shared network
+        #  2. Deploy a VM in shared network so that router is
+        #     created
+        #  3. Verify that corresponding port groups are created
+              for guest traffic
+        """
+
+        if self.hypervisor.lower() != "vmware":
+            self.skipTest("This test is intended for only vmware")
+
+        physical_network, shared_vlan = get_free_vlan(
+            self.api_client, self.zone.id)
+        if shared_vlan is None:
+            self.fail("Failed to get free vlan id for shared network")
+
+        self.testdata["shared_network_offering"]["specifyVlan"] = "True"
+        self.testdata["shared_network_offering"]["specifyIpRanges"] = "True"
+
+        # Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+            self.api_client,
+            self.testdata["shared_network_offering"],
+            conservemode=False
+        )
+
+        # Update network offering state from disabled to enabled.
+        NetworkOffering.update(
+            self.shared_network_offering,
+            self.api_client,
+            id=self.shared_network_offering.id,
+            state="enabled"
+        )
+
+        # create network using the shared network offering created
+        self.testdata["shared_network"]["acltype"] = "Domain"
+        self.testdata["shared_network"][
+            "networkofferingid"] = self.shared_network_offering.id
+        self.testdata["shared_network"][
+            "physicalnetworkid"] = physical_network.id
+        self.testdata["shared_network"]["vlan"] = shared_vlan
+
+        self.network = Network.create(
+            self.api_client,
+            self.testdata["shared_network"],
+            networkofferingid=self.shared_network_offering.id,
+            zoneid=self.zone.id,
+        )
+        self.cleanup_networks.append(self.network)
+
+        vm = VirtualMachine.create(
+            self.api_client,
+            self.testdata["virtual_machine"],
+            networkids=self.network.id,
+            serviceofferingid=self.service_offering.id
+        )
+        self.cleanup_vms.append(vm)
+
+        routers = Router.list(self.api_client,
+                    networkid=self.network.id,
+                    listall=True)
+
+        self.assertEqual(validateList(routers)[0], PASS,
+                "No Router associated with the network found")
+
+        response = verifyGuestTrafficPortGroups(self.api_client,
+                                                self.config,
+                                                self.zone)
+        self.assertEqual(response[0], PASS, response[1])
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9777e905/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index b1c5805..00d2029 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -17,7 +17,8 @@
 """ BVT tests for Network Life Cycle
 """
 # Import Local Modules
-from marvin.codes import FAILED, STATIC_NAT_RULE, LB_RULE, NAT_RULE
+from marvin.codes import (FAILED, STATIC_NAT_RULE, LB_RULE,
+                          NAT_RULE, PASS)
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.cloudstackException import CloudstackAPIException
 from marvin.cloudstackAPI import rebootRouter
@@ -43,7 +44,8 @@ from marvin.lib.common import (get_domain,
                                list_routers,
                                list_virtual_machines,
                                list_lb_rules,
-                               list_configurations)
+                               list_configurations,
+                               verifyGuestTrafficPortGroups)
 from nose.plugins.attrib import attr
 from ddt import ddt, data
 # Import System modules
@@ -247,6 +249,7 @@ class TestPortForwarding(cloudstackTestCase):
         testClient = super(TestPortForwarding, cls).getClsTestClient()
         cls.apiclient = testClient.getApiClient()
         cls.services = testClient.getParsedTestDataConfig()
+        cls.hypervisor = testClient.getHypervisorInfo()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
@@ -551,6 +554,17 @@ class TestPortForwarding(cloudstackTestCase):
             )
         return
 
+    @attr(tags=["advanced", "dvs"], required_hardware="true")
+    def test_guest_traffic_port_groups_isolated_network(self):
+        """ Verify port groups are created for guest traffic
+        used by isolated network """
+
+        if self.hypervisor.lower() == "vmware":
+            response = verifyGuestTrafficPortGroups(self.apiclient,
+                                                    self.config,
+                                                    self.zone)
+            assert response[0] == PASS, response[1]
+
 
 class TestRebootRouter(cloudstackTestCase):
 


[18/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: boxing/unboxing removed

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb02a32f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb02a32f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb02a32f

Branch: refs/heads/reporter
Commit: cb02a32f792dff6ca478b4b461c0ad88b73332f3
Parents: 72b2422
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 20:16:13 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 20:16:13 2015 +0200

----------------------------------------------------------------------
 .../wrapper/XenServer56NetworkUsageCommandWrapper.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb02a32f/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/XenServer56NetworkUsageCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/XenServer56NetworkUsageCommandWrapper.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/XenServer56NetworkUsageCommandWrapper.java
index 0e3f922..9132aa1 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/XenServer56NetworkUsageCommandWrapper.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/XenServer56NetworkUsageCommandWrapper.java
@@ -21,13 +21,14 @@ package com.cloud.hypervisor.xenserver.resource.wrapper;
 
 import org.apache.log4j.Logger;
 
+import com.xensource.xenapi.Connection;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.NetworkUsageAnswer;
 import com.cloud.agent.api.NetworkUsageCommand;
 import com.cloud.hypervisor.xenserver.resource.XenServer56Resource;
 import com.cloud.resource.CommandWrapper;
 import com.cloud.utils.ExecutionResult;
-import com.xensource.xenapi.Connection;
 
 public final class XenServer56NetworkUsageCommandWrapper extends CommandWrapper<NetworkUsageCommand, Answer, XenServer56Resource> {
 
@@ -87,8 +88,8 @@ public final class XenServer56NetworkUsageCommandWrapper extends CommandWrapper<
                     final String[] splitResult = detail.split(":");
                     int i = 0;
                     while (i < splitResult.length - 1) {
-                        stats[0] += new Long(splitResult[i++]).longValue();
-                        stats[1] += new Long(splitResult[i++]).longValue();
+                        stats[0] += Long.parseLong(splitResult[i++]);
+                        stats[1] += Long.parseLong(splitResult[i++]);
                     }
                     return new NetworkUsageAnswer(command, "success", stats[0], stats[1]);
                 }


[29/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
server: fix system account create logs

Don't output scary message, avoid logging network_group table not found and
log sane messages if system/admin account/user already exist.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 5599dee90d0ae84d80089b44696a891ae48ecec0)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/74e0a5f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/74e0a5f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/74e0a5f9

Branch: refs/heads/reporter
Commit: 74e0a5f9eca9b896c654a3f9fbdadcf5ae80e9c2
Parents: 37820e1
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:30:43 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:36 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/server/ConfigurationServerImpl.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/74e0a5f9/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index e839fc7..157ea03 100644
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -473,7 +473,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
                     stmt.executeUpdate();
                 } catch (SQLException ex) {
-                    s_logger.debug("Caught exception when inserting system account: " + ex.getMessage());
+                    s_logger.debug("Looks like system account already exists");
                 }
                 // insert system user
                 insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, user.default)"
@@ -483,7 +483,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
                     stmt.executeUpdate();
                 } catch (SQLException ex) {
-                    s_logger.debug("Caught SQLException when inserting system user: " + ex.getMessage());
+                    s_logger.debug("Looks like system user already exists");
                 }
 
                 // insert admin user, but leave the account disabled until we set a
@@ -500,7 +500,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
                     stmt.executeUpdate();
                 } catch (SQLException ex) {
-                    s_logger.debug("Caught SQLException when creating admin account: " + ex.getMessage());
+                    s_logger.debug("Looks like admin account already exists");
                 }
 
                 // now insert the user
@@ -511,7 +511,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
                     stmt.executeUpdate();
                 } catch (SQLException ex) {
-                    s_logger.debug("Caught SQLException when inserting admin user: " + ex.getMessage());
+                    s_logger.debug("Looks like admin user already exists");
                 }
 
                 try {
@@ -522,8 +522,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                         stmt.executeQuery();
                         tableName = "network_group";
                     } catch (Exception ex) {
-                        // if network_groups table exists, create the default security group there
-                        s_logger.debug("Caught (SQL?)Exception: no network_group  " + ex.getLocalizedMessage());
+                        // Ignore in case of exception, table must not exist
                     }
 
                     insertSql = "SELECT * FROM " + tableName + " where account_id=2 and name='default'";


[31/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
server: fix NPE case in VolumeApiServiceImpl

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit df934c954106a618f8b0aca7e7dfbac890d78244)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a07497b3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a07497b3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a07497b3

Branch: refs/heads/reporter
Commit: a07497b3731372bf902aae9569e6d579abaec3f8
Parents: 48ef7e5
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:33:23 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:51 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a07497b3/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index cae1e1d..dbae194 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1650,12 +1650,12 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         }
 
         HostVO host = null;
-        StoragePoolVO volumePool = _storagePoolDao.findById(volume.getPoolId());
+        StoragePoolVO volumePool = _storagePoolDao.findByIdIncludingRemoved(volume.getPoolId());
 
         if (hostId != null) {
             host = _hostDao.findById(hostId);
 
-            if (host != null && host.getHypervisorType() == HypervisorType.XenServer && volumePool.isManaged()) {
+            if (host != null && host.getHypervisorType() == HypervisorType.XenServer && volumePool != null && volumePool.isManaged()) {
                 sendCommand = true;
             }
         }


[22/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: comparison of wrapper classes should use equals

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d3a98ab0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d3a98ab0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d3a98ab0

Branch: refs/heads/reporter
Commit: d3a98ab0d00c787cb0fe2b53d532de65c873f4fb
Parents: 67719b1
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 21:00:21 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 21:00:21 2015 +0200

----------------------------------------------------------------------
 .../src/com/cloud/network/element/BigSwitchBcfElement.java       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d3a98ab0/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
index 37391a6..1dbf62d 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
@@ -684,7 +684,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             }
             cidrList = r.getSourceCidrList();
             if(cidrList != null){
-                if(cidrList.size()>1 || r.getSourcePortEnd()!=r.getSourcePortStart()){
+                if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) {
                     throw new ResourceUnavailableException("One CIDR and one port only please.",
                             Network.class, network.getId());
                 } else {
@@ -718,7 +718,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             }
             cidrList = r.getSourceCidrList();
             if(cidrList != null){
-                if(cidrList.size()>1 || r.getSourcePortEnd()!=r.getSourcePortStart()){
+                if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) {
                     throw new ResourceUnavailableException("One CIDR and one port only please.",
                             Network.class, network.getId());
                 } else {


[03/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/NetworkData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/NetworkData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/NetworkData.java
new file mode 100644
index 0000000..cafbc90
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/NetworkData.java
@@ -0,0 +1,217 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * NetworkData contains information expected by Big Switch Controller
+ * in CreateBcfSegmentCommand
+ */
+public class NetworkData {
+    private final Network network;
+
+    public Network getNetwork() {
+        return network;
+    }
+
+    public NetworkData() {
+        network = new Network();
+    }
+
+    public class Network {
+        @SerializedName("id") private String id;
+        @SerializedName("name") private String name = null;
+        @SerializedName("tenant_id") private String tenantId = null;
+        @SerializedName("tenant_name") private String tenantName = null;
+        @SerializedName("state") private String state = null;
+        @SerializedName("subnets") private List<Segment> segments = null;
+        @SerializedName("provider:segmentation_id") private Integer vlan = null;
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getTenantId() {
+            return tenantId;
+        }
+
+        public void setTenantId(String tenantId) {
+            this.tenantId = tenantId;
+        }
+
+        public String getTenantName() {
+            return tenantName;
+        }
+
+        public void setTenantName(String tenantName) {
+            this.tenantName = tenantName;
+        }
+
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+
+        public List<Segment> getSegments() {
+            return segments;
+        }
+
+        public void setSegments(List<Segment> segments) {
+            this.segments = segments;
+        }
+
+        public Integer getVlan() {
+            return vlan;
+        }
+
+        public void setVlan(Integer vlan) {
+            this.vlan = vlan;
+        }
+    }
+
+    public class Segment {
+        @SerializedName("cidr") private String cidr;
+        @SerializedName("gateway_ip") private String gatewayIp;
+        @SerializedName("id") private String id;
+        @SerializedName("name") private String name;
+        @SerializedName("state") private String state;
+        @SerializedName("tenant_id") private String tenantId;
+
+        public String getCidr() {
+            return cidr;
+        }
+
+        public void setCidr(String cidr) {
+            this.cidr = cidr;
+        }
+
+        public String getGatewayIp() {
+            return gatewayIp;
+        }
+
+        public void setGatewayIp(String gatewayIp) {
+            this.gatewayIp = gatewayIp;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+
+        public String getTenantId() {
+            return tenantId;
+        }
+
+        public void setTenantId(String tenantId) {
+            this.tenantId = tenantId;
+        }
+    }
+
+
+
+    public class AttachmentInfo {
+        @SerializedName("id") private String id = null;
+        @SerializedName("mac") private String mac = null;
+
+        public AttachmentInfo(String id, String mac){
+            this.id = id;
+            this.mac = mac;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public String getMac() {
+            return mac;
+        }
+
+        public void setMac(String mac) {
+            this.mac = mac;
+        }
+    }
+
+    public class SegmentInfo {
+        @SerializedName("network_type") private String networkType = null;
+        @SerializedName("segmentation_id") private Integer segmentationId = 0;
+
+        public SegmentInfo(String networkType, Integer segmentationId){
+            this.networkType = networkType;
+            this.segmentationId = segmentationId;
+        }
+
+        public String getNetworkType() {
+            return networkType;
+        }
+
+        public void setNetworkType(String networkType) {
+            this.networkType = networkType;
+        }
+
+        public Integer getSegmentationId() {
+            return segmentationId;
+        }
+
+        public void setSegmentationId(Integer segmentationId) {
+            this.segmentationId = segmentationId;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterData.java
new file mode 100644
index 0000000..2d61653
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterData.java
@@ -0,0 +1,131 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+public class RouterData {
+    @SerializedName("router") private Router router;
+
+    public RouterData(String tenantId){
+        router = new Router(tenantId);
+    }
+
+    public class Router {
+        @SerializedName("tenant_id") private String tenantId;
+        @SerializedName("id") private String id;
+        @SerializedName("external_gateway_info") private ExternalGateway externalGateway;
+        @SerializedName("router_rules") private List<AclData> acls;
+        @SerializedName("interfaces") private List<RouterInterfaceData.RouterInterface> interfaces;
+
+        public Router(String tenantId){
+            this.tenantId = tenantId;
+            this.id = tenantId;
+            this.externalGateway = null;
+            this.acls = new ArrayList<AclData>();
+            this.interfaces = null;
+        }
+
+        public List<AclData> getAcls() {
+            return acls;
+        }
+
+        public class ExternalGateway{
+            @SerializedName("tenant_id") private String tenantId;
+            @SerializedName("network_id") private String networkId;
+            @SerializedName("external_fixed_ips") private List<ExternalIp> externalIps;
+
+            public ExternalGateway(String gatewayIp){
+                this.tenantId = "external";
+                this.networkId = "external";
+                this.externalIps = new ArrayList<ExternalIp>();
+                if(gatewayIp!=null){
+                    this.externalIps.add(new ExternalIp(gatewayIp));
+                }
+            }
+
+            public class ExternalIp{
+                @SerializedName("subnet_id") private String subnetId; //assume don't care for now
+                @SerializedName("ip_address") private String ipAddress;
+
+                public ExternalIp(String ipAddress){
+                    this.subnetId = "";
+                    this.ipAddress = ipAddress;
+                }
+
+                public String getSubnetId() {
+                    return subnetId;
+                }
+
+                public String getIpAddress() {
+                    return ipAddress;
+                }
+            }
+
+            public String getNetworkId() {
+                return networkId;
+            }
+
+            public List<ExternalIp> getExternalIps() {
+                return externalIps;
+            }
+        }
+
+        public void addExternalGateway(String gatewayIp){
+            if(gatewayIp != null){
+                this.externalGateway = new ExternalGateway(gatewayIp);
+            }
+        }
+
+        public String getTenantId() {
+            return tenantId;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public ExternalGateway getExternalGateway() {
+            return externalGateway;
+        }
+
+        public List<RouterInterfaceData.RouterInterface> getInterfaces() {
+            return interfaces;
+        }
+
+        public void addInterface(RouterInterfaceData intf){
+            if(this.interfaces == null){
+                this.interfaces = new ArrayList<RouterInterfaceData.RouterInterface>();
+            }
+            this.interfaces.add(intf.getRouterInterface());
+        }
+
+        public void setInterfaces(List<RouterInterfaceData.RouterInterface> interfaces) {
+            this.interfaces = interfaces;
+        }
+    }
+
+    public Router getRouter() {
+        return router;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterInterfaceData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterInterfaceData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterInterfaceData.java
new file mode 100644
index 0000000..a00535e
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/RouterInterfaceData.java
@@ -0,0 +1,67 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import com.google.gson.annotations.SerializedName;
+
+public class RouterInterfaceData {
+    @SerializedName("interface") private RouterInterface routerInterface;
+
+    public RouterInterfaceData(String tenantId, String gatewayIp, String cidr, String id, String name){
+        routerInterface = new RouterInterface(tenantId, gatewayIp, cidr, id, name);
+    }
+
+    public class RouterInterface {
+        @SerializedName("subnet") private NetworkData.Segment subnet;
+        @SerializedName("id") private String id;
+        @SerializedName("network") private NetworkData.Network network;
+
+        public RouterInterface(String tenantId, String gatewayIp, String cidr, String id, String name){
+            NetworkData data = new NetworkData();
+            this.subnet = data.new Segment();
+            this.subnet.setTenantId(tenantId);
+            this.subnet.setGatewayIp(gatewayIp);
+            this.subnet.setCidr(cidr);
+
+            this.id = id;
+
+            this.network = data.getNetwork();
+            this.network.setTenantId(tenantId);
+            this.network.setId(id);
+            this.network.setName(name);
+        }
+
+        public NetworkData.Segment getSubnet() {
+            return subnet;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public NetworkData.Network getNetwork() {
+            return network;
+        }
+    }
+
+    public RouterInterface getRouterInterface() {
+        return routerInterface;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TopologyData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TopologyData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TopologyData.java
new file mode 100644
index 0000000..cbaeeff
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TopologyData.java
@@ -0,0 +1,249 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.network.bigswitch.AttachmentData.Attachment.IpAddress;
+import com.cloud.network.bigswitch.NetworkData.AttachmentInfo;
+import com.cloud.network.bigswitch.NetworkData.Segment;
+import com.cloud.network.bigswitch.NetworkData.SegmentInfo;
+import com.cloud.network.bigswitch.RouterData.Router;
+import com.google.gson.annotations.SerializedName;
+
+public class TopologyData {
+    @SerializedName("networks") private final List<Network> networks;
+    @SerializedName("routers") private final List<Router> routers;
+
+    public void addNetwork(Network network) {
+        networks.add(network);
+    }
+
+    public void setNetworks(List<Network> networks) {
+        this.networks.clear();
+        this.networks.addAll(networks);
+    }
+
+    public void clearNetworks() {
+        this.networks.clear();
+    }
+
+    public void addRouter(Router router) {
+        routers.add(router);
+    }
+
+    public void setRouters(List<Router> routers) {
+        this.routers.clear();
+        this.routers.addAll(routers);
+    }
+
+    public void clearRouters() {
+        this.routers.clear();
+    }
+
+    public TopologyData() {
+        networks = new ArrayList<Network>();
+        routers = new ArrayList<Router>();
+    }
+
+    public class Network {
+        @SerializedName("id") private String id;
+        @SerializedName("name") private String name;
+        @SerializedName("tenant_id") private String tenantId;
+        @SerializedName("tenant_name") private String tenantName;
+        @SerializedName("provider:segmentation_id") private Integer vlan = null;
+        @SerializedName("state") private String state;
+        @SerializedName("ports") private List<Port> ports;
+        @SerializedName("subnets") private List<Segment> segments;
+
+        public String getId() {
+            return id;
+        }
+        public void setId(String id) {
+            this.id = id;
+        }
+        public String getName() {
+            return name;
+        }
+        public void setName(String name) {
+            this.name = name;
+        }
+        public String getTenantId() {
+            return tenantId;
+        }
+        public void setTenantId(String tenantId) {
+            this.tenantId = tenantId;
+        }
+        public String getTenantName() {
+            return tenantName;
+        }
+        public void setTenantName(String tenantName) {
+            this.tenantName = tenantName;
+        }
+        public Integer getVlan() {
+            return vlan;
+        }
+        public void setVlan(Integer vlan) {
+            this.vlan = vlan;
+        }
+        public String getState() {
+            return state;
+        }
+        public void setState(String state) {
+            this.state = state;
+        }
+        public List<Port> getPorts() {
+            return ports;
+        }
+        public void setPorts(List<Port> ports) {
+            this.ports = ports;
+        }
+        public List<Segment> getSegments() {
+            return segments;
+        }
+        public void setSegments(List<Segment> segments) {
+            this.segments = segments;
+        }
+        @Override
+        public String toString() {
+            return "Network [id=" + id + ", name=" + name + ", tenantId="
+                    + tenantId + ", tenantName=" + tenantName + ", vlan="
+                    + vlan + ", state=" + state + ", ports=" + ports
+                    + ", segments=" + segments + "]";
+        }
+    }
+
+    public class Port {
+        @SerializedName("attachment") private AttachmentInfo attachment;
+        @SerializedName("binding:host_id") private String hostId;
+        @SerializedName("bound_segment") private SegmentInfo segmentInfo;
+        @SerializedName("device_owner") private String owner;
+        @SerializedName("fixed_ips") private List<IpAddress> ipAddresses;
+        @SerializedName("id") private String id;
+        @SerializedName("mac_address") private String mac;
+        @SerializedName("network") private NetworkData.Network network;
+        @SerializedName("state") private String state;
+        @SerializedName("tenant_id") private String tenantId;
+        @SerializedName("tenant_name") private String tenantName;
+
+        public AttachmentInfo getAttachment() {
+            return attachment;
+        }
+
+        public void setAttachmentInfo(AttachmentInfo attachment) {
+            this.attachment = attachment;
+        }
+
+        public String getHostId() {
+            return hostId;
+        }
+
+        public void setHostId(String hostId) {
+            this.hostId = hostId;
+        }
+
+        public SegmentInfo getSegmentInfo() {
+            return segmentInfo;
+        }
+
+        public void setSegmentInfo(SegmentInfo segmentInfo) {
+            this.segmentInfo = segmentInfo;
+        }
+
+        public String getOwner() {
+            return owner;
+        }
+
+        public void setOwner(String owner) {
+            this.owner = owner;
+        }
+
+        public List<IpAddress> getIpAddresses() {
+            return ipAddresses;
+        }
+
+        public void setIpAddresses(List<IpAddress> ipAddresses) {
+            this.ipAddresses = ipAddresses;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        public String getMac() {
+            return mac;
+        }
+
+        public void setMac(String mac) {
+            this.mac = mac;
+        }
+
+        public NetworkData.Network getNetwork() {
+            return network;
+        }
+
+        public void setNetwork(NetworkData.Network network) {
+            this.network = network;
+        }
+
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+
+        public String getTenantId() {
+            return tenantId;
+        }
+
+        public void setTenantId(String tenantId) {
+            this.tenantId = tenantId;
+        }
+
+        public String getTenantName() {
+            return tenantName;
+        }
+
+        public void setTenantName(String tenantName) {
+            this.tenantName = tenantName;
+        }
+    }
+
+    public List<Network> getNetworks() {
+        return networks;
+    }
+
+    public List<Router> getRouters() {
+        return routers;
+    }
+
+    @Override
+    public String toString() {
+        return "TopologyData [networks=" + networks + ", routers=" + routers
+                + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TrustingProtocolSocketFactory.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TrustingProtocolSocketFactory.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TrustingProtocolSocketFactory.java
new file mode 100644
index 0000000..09c444b
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/TrustingProtocolSocketFactory.java
@@ -0,0 +1,114 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.bigswitch;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.apache.commons.httpclient.params.HttpConnectionParams;
+import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
+
+/*
+ * The TrustingProtocolSocketFactory will accept any provided
+ * certificate, i.e., in a sticky mode certificate management scheme,
+ * when making an SSL connection to the Big Switch Controller
+ */
+public class TrustingProtocolSocketFactory implements SecureProtocolSocketFactory {
+    private SSLSocketFactory ssf;
+
+    public TrustingProtocolSocketFactory() throws IOException {
+        // Create a trust manager that does not validate certificate chains
+        TrustManager[] trustAllCerts = new TrustManager[] {
+                new X509TrustManager() {
+                    @Override
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return null;
+                    }
+
+                    @Override
+                    public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                        // Trust always
+                    }
+
+                    @Override
+                    public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                        // Trust always
+                    }
+                }
+        };
+
+        try {
+            // Install the all-trusting trust manager
+            SSLContext sc = SSLContext.getInstance("SSL");
+            sc.init(null, trustAllCerts, new java.security.SecureRandom());
+            ssf =  sc.getSocketFactory();
+        } catch (KeyManagementException e) {
+            throw new IOException(e);
+        } catch (NoSuchAlgorithmException e) {
+            throw new IOException(e);
+        }
+    }
+
+    @Override
+    public Socket createSocket(String host, int port) throws IOException,
+    UnknownHostException {
+        return ssf.createSocket(host, port);
+    }
+
+    @Override
+    public Socket createSocket(String address, int port, InetAddress localAddress,
+            int localPort) throws IOException, UnknownHostException {
+        return ssf.createSocket(address, port, localAddress, localPort);
+    }
+
+    @Override
+    public Socket createSocket(Socket socket, String host, int port,
+            boolean autoClose) throws IOException, UnknownHostException {
+        return ssf.createSocket(socket, host, port, autoClose);
+    }
+
+    @Override
+    public Socket createSocket(String host, int port, InetAddress localAddress,
+            int localPort, HttpConnectionParams params) throws IOException,
+            UnknownHostException, ConnectTimeoutException {
+        int timeout = params.getConnectionTimeout();
+        if (timeout == 0) {
+            return createSocket(host, port, localAddress, localPort);
+        }
+        else {
+            Socket s = ssf.createSocket();
+            s.bind(new InetSocketAddress(localAddress, localPort));
+            s.connect(new InetSocketAddress(host, port), timeout);
+            return s;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDao.java b/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDao.java
new file mode 100644
index 0000000..8cf84e4
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDao.java
@@ -0,0 +1,35 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface BigSwitchBcfDao extends GenericDao<BigSwitchBcfDeviceVO, Long> {
+    /**
+     * list all the BigSwitch BCF Controller devices added in to this physical network
+     * @param physicalNetworkId physical Network Id
+     * @return list of BigSwitchBcfDeviceVO for this physical network.
+     */
+    List<BigSwitchBcfDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDaoImpl.java b/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDaoImpl.java
new file mode 100644
index 0000000..f0b4a06
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/dao/BigSwitchBcfDaoImpl.java
@@ -0,0 +1,53 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value = BigSwitchBcfDao.class)
+public class BigSwitchBcfDaoImpl extends GenericDaoBase<BigSwitchBcfDeviceVO, Long> implements BigSwitchBcfDao {
+
+    protected final SearchBuilder<BigSwitchBcfDeviceVO> physicalNetworkIdSearch;
+
+    public BigSwitchBcfDaoImpl() {
+        physicalNetworkIdSearch = createSearchBuilder();
+        physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkIdSearch.done();
+    }
+
+    @Override
+    public List<BigSwitchBcfDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<BigSwitchBcfDeviceVO> sc = physicalNetworkIdSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
new file mode 100644
index 0000000..2de447e
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
@@ -0,0 +1,785 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.element;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+import org.apache.commons.net.util.SubnetUtils;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.BcfAnswer;
+import com.cloud.agent.api.UpdateBcfRouterCommand;
+import com.cloud.agent.api.CreateBcfAttachmentCommand;
+import com.cloud.agent.api.CreateBcfStaticNatCommand;
+import com.cloud.agent.api.DeleteBcfAttachmentCommand;
+import com.cloud.agent.api.DeleteBcfStaticNatCommand;
+import com.cloud.agent.api.StartupBigSwitchBcfCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.api.ApiDBUtils;
+import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd;
+import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd;
+import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd;
+import com.cloud.api.commands.BcfConstants;
+import com.cloud.api.response.BigSwitchBcfDeviceResponse;
+import com.cloud.configuration.ConfigurationManager;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.deploy.DeployDestination;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.host.DetailVO;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.host.dao.HostDetailsDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.network.IpAddressManager;
+import com.cloud.network.Network;
+import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PublicIpAddress;
+import com.cloud.network.bigswitch.AclData;
+import com.cloud.network.bigswitch.BigSwitchBcfApi;
+import com.cloud.network.bigswitch.BigSwitchBcfUtils;
+import com.cloud.network.bigswitch.TopologyData;
+import com.cloud.network.dao.BigSwitchBcfDao;
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkServiceMapDao;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
+import com.cloud.network.dao.PhysicalNetworkVO;
+import com.cloud.network.resource.BigSwitchBcfResource;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.StaticNat;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.NetworkACLItemCidrsDao;
+import com.cloud.network.vpc.NetworkACLItemDao;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.resource.ResourceManager;
+import com.cloud.resource.ResourceState;
+import com.cloud.resource.ResourceStateAdapter;
+import com.cloud.resource.ServerResource;
+import com.cloud.resource.UnableDeleteHostException;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionStatus;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.dao.DomainRouterDao;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+/**
+ * BigSwitchBcfElement is responsible for creating and plugging a nic into a BCF Segment network.
+ * When a VM is created and needs to be plugged into a BCF Segment network, BigSwitchBcfElement is
+ * called by NetworkOrchestrator to create a "port" and an "attachment" for each nic, and
+ * register them with the controller to be plugged into the corresponding network. It also
+ * removes them when the VM is destroyed.
+ */
+@Component
+@Local(value = {NetworkElement.class, ConnectivityProvider.class, IpDeployer.class,
+        SourceNatServiceProvider.class, StaticNatServiceProvider.class,
+        NetworkACLServiceProvider.class, FirewallServiceProvider.class})
+public class BigSwitchBcfElement extends AdapterBase implements BigSwitchBcfElementService,
+ConnectivityProvider, IpDeployer, SourceNatServiceProvider, StaticNatServiceProvider,
+NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
+    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfElement.class);
+
+    private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
+
+    @Inject
+    ResourceManager _resourceMgr;
+    @Inject
+    PhysicalNetworkDao _physicalNetworkDao;
+    @Inject
+    PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
+    @Inject
+    BigSwitchBcfDao _bigswitchBcfDao;
+    @Inject
+    HostDetailsDao _hostDetailsDao;
+    @Inject
+    HostDao _hostDao;
+    @Inject
+    AgentManager _agentMgr;
+    @Inject
+    NetworkDao _networkDao;
+    @Inject
+    DomainRouterDao _routerDao;
+    @Inject
+    NicDao _nicDao;
+    @Inject
+    VMInstanceDao _vmDao;
+    @Inject
+    AccountDao _accountDao;
+    @Inject
+    VpcDao _vpcDao;
+    @Inject
+    NetworkModel _networkModel;
+    @Inject
+    ConfigurationManager _configMgr;
+    @Inject
+    NetworkServiceMapDao _ntwkSrvcDao;
+    @Inject
+    DataCenterDao _zoneDao;
+    @Inject
+    IPAddressDao _ipAddressDao;
+    @Inject
+    IpAddressManager _ipAddrMgr;
+    @Inject
+    VlanDao _vlanDao;
+    @Inject
+    FirewallRulesDao _fwRulesDao;
+    @Inject
+    FirewallRulesCidrsDao _fwCidrsDao;
+    @Inject
+    NetworkACLItemDao _aclItemDao;
+    @Inject
+    NetworkACLItemCidrsDao _aclItemCidrsDao;
+
+    private BigSwitchBcfUtils _bcfUtils = null;
+
+    @Override
+    public Map<Service, Map<Capability, String>> getCapabilities() {
+        return capabilities;
+    }
+
+    @Override
+    public Provider getProvider() {
+        return Provider.BigSwitchBcf;
+    }
+
+    private boolean canHandle(Network network, Service service) {
+        s_logger.debug("Checking if BigSwitchBcfElement can handle service " + service.getName() + " on network " + network.getDisplayText());
+        if (network.getBroadcastDomainType() != BroadcastDomainType.Vlan) {
+            return false;
+        }
+
+        if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
+            s_logger.debug("BigSwitchBcfElement is not a provider for network " + network.getDisplayText());
+            return false;
+        }
+
+        if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, BcfConstants.BigSwitchBcf)) {
+            s_logger.debug("BigSwitchBcfElement can't provide the " + service.getName() + " service on network " + network.getDisplayText());
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        super.configure(name, params);
+        _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
+        return true;
+    }
+
+    @Override
+    public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+        ResourceUnavailableException, InsufficientCapacityException {
+        updateBcfRouter(network);
+        return true;
+    }
+
+    @Override
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
+        throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+
+        if (!canHandle(network, Service.Connectivity)) {
+            return false;
+        }
+
+        bcfUtilsInit();
+
+        // get arguments for CreateBcfAttachmentCommand
+        // determine whether this is VPC network or stand-alone network
+        Vpc vpc = null;
+        if(network.getVpcId()!=null){
+            vpc = _vpcDao.acquireInLockTable(network.getVpcId());
+        }
+
+        String tenantId;
+        String tenantName;
+        if (vpc != null) {
+            tenantId = vpc.getUuid();
+            tenantName = vpc.getName();
+            _vpcDao.releaseFromLockTable(vpc.getId());
+        } else {
+            // use account in CS as tenant in BSN
+            // use network id/name as tenant id/name for non-VPC networks
+            tenantId = network.getUuid();
+            tenantName = network.getName();
+        }
+
+        String networkId = network.getUuid();
+        String hostname = dest.getHost().getName();
+        String nicId = nic.getUuid();
+        Integer vlan = Integer.valueOf(BroadcastDomainType.getValue(nic.getIsolationUri()));
+        String ipv4 = nic.getIp4Address();
+        String mac = nic.getMacAddress();
+        long zoneId = network.getDataCenterId();
+        String vmwareVswitchLabel = _networkModel.getDefaultGuestTrafficLabel(zoneId, HypervisorType.VMware);
+        String[] labelArray = null;
+        String vswitchName = null;
+        if(vmwareVswitchLabel!=null){
+            labelArray=vmwareVswitchLabel.split(",");
+            vswitchName = labelArray[0];
+        }
+
+        // hypervisor type:
+        //   kvm: ivs port name
+        //   vmware: specific portgroup naming convention
+        String pgName = "";
+        if (dest.getHost().getHypervisorType() == HypervisorType.KVM){
+            pgName = hostname;
+        } else if (dest.getHost().getHypervisorType() == HypervisorType.VMware){
+            pgName = hostname + "-" + vswitchName;
+        }
+
+        CreateBcfAttachmentCommand cmd = new CreateBcfAttachmentCommand(tenantId,
+                tenantName, networkId, pgName, nicId, vlan, ipv4, mac);
+
+        _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+
+        return true;
+    }
+
+    @Override
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
+        ResourceUnavailableException {
+
+        if (!canHandle(network, Service.Connectivity)) {
+            return false;
+        }
+
+        if (network.getBroadcastUri() == null) {
+            s_logger.error("Nic has no broadcast Uri");
+            return false;
+        }
+
+        bcfUtilsInit();
+
+        String networkId = network.getUuid();
+        String nicId = nic.getUuid();
+
+        String tenantId;
+        if(network.getVpcId()!=null) {
+            tenantId = network.getNetworkDomain();
+        } else {
+            tenantId = networkId;
+        }
+
+        DeleteBcfAttachmentCommand cmd = new DeleteBcfAttachmentCommand(tenantId, networkId, nicId);
+
+        _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+        return true;
+    }
+
+    @Override
+    public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
+        if (!canHandle(network, Service.Connectivity)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
+        if (!canHandle(network, Service.Connectivity)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean isReady(PhysicalNetworkServiceProvider provider) {
+        return true;
+    }
+
+    @Override
+    public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException,
+        ResourceUnavailableException {
+        return true;
+    }
+
+    @Override
+    public boolean canEnableIndividualServices() {
+        return true;
+    }
+
+    @Override
+    public boolean verifyServicesCombination(Set<Service> services) {
+        if (!services.contains(Service.Connectivity)) {
+            s_logger.warn("Unable to provide services without Connectivity service enabled for this element");
+            return false;
+        }
+        return true;
+    }
+
+    private static Map<Service, Map<Capability, String>> setCapabilities() {
+        Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
+
+        // L2 Support
+        capabilities.put(Service.Connectivity, null);
+
+        // L3 Support
+        capabilities.put(Service.Gateway, null);
+
+        // L3 Support : SourceNat
+        Map<Capability, String> sourceNatCapabilities = new HashMap<Capability, String>();
+        sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, "peraccount");
+        sourceNatCapabilities.put(Capability.RedundantRouter, "false");
+        capabilities.put(Service.SourceNat, sourceNatCapabilities);
+
+        // L3 support : StaticNat
+        capabilities.put(Service.StaticNat, null);
+
+        //add network ACL capability
+        Map<Network.Capability, String> networkACLCapabilities = new HashMap<Network.Capability, String>();
+        networkACLCapabilities.put(Network.Capability.SupportedProtocols, "tcp,udp,icmp");
+        capabilities.put(Network.Service.NetworkACL, networkACLCapabilities);
+
+        // Set capabilities for Firewall service
+        Map<Capability, String> firewallCapabilities = new HashMap<Capability, String>();
+        firewallCapabilities.put(Capability.TrafficStatistics, "per public ip");
+        firewallCapabilities.put(Capability.SupportedProtocols, "tcp,udp,icmp");
+        firewallCapabilities.put(Capability.SupportedEgressProtocols, "tcp,udp,icmp, all");
+        firewallCapabilities.put(Capability.SupportedTrafficDirection, "ingress, egress");
+        firewallCapabilities.put(Capability.MultipleIps, "true");
+        capabilities.put(Service.Firewall, firewallCapabilities);
+
+        return capabilities;
+    }
+
+    @Override
+    @DB
+    public BigSwitchBcfDeviceVO addBigSwitchBcfDevice(AddBigSwitchBcfDeviceCmd cmd) {
+        BigSwitchBcfDeviceVO newBcfDevice;
+
+        bcfUtilsInit();
+
+        ServerResource resource = new BigSwitchBcfResource();
+
+        final String deviceName = BcfConstants.BigSwitchBcf.getName();
+        NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName);
+        final Long physicalNetworkId = cmd.getPhysicalNetworkId();
+        final String hostname = cmd.getHost();
+        final String username = cmd.getUsername();
+        final String password = cmd.getPassword();
+        final Boolean nat = cmd.getNat();
+
+        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
+        if (physicalNetwork == null) {
+            throw new InvalidParameterValueException("Could not find phyical network with ID: " + physicalNetworkId);
+        }
+        long zoneId = physicalNetwork.getDataCenterId();
+
+        final PhysicalNetworkServiceProviderVO ntwkSvcProvider =
+            _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(), networkDevice.getNetworkServiceProvder());
+        if (ntwkSvcProvider == null) {
+            throw new CloudRuntimeException("Network Service Provider: " + networkDevice.getNetworkServiceProvder() + " is not enabled in the physical network: " +
+                physicalNetworkId + "to add this device");
+        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
+            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + " is in shutdown state in the physical network: " +
+                physicalNetworkId + "to add this device");
+        }
+        ntwkSvcProvider.setFirewallServiceProvided(true);
+        ntwkSvcProvider.setGatewayServiceProvided(true);
+        ntwkSvcProvider.setNetworkAclServiceProvided(true);
+        ntwkSvcProvider.setSourcenatServiceProvided(true);
+        ntwkSvcProvider.setStaticnatServiceProvided(true);
+
+        if (_bigswitchBcfDao.listByPhysicalNetwork(physicalNetworkId).size() > 1) {
+            throw new CloudRuntimeException("At most two BCF controllers can be configured");
+        }
+
+        DataCenterVO zone = _zoneDao.findById(physicalNetwork.getDataCenterId());
+        String zoneName;
+        if(zone!= null){
+            zoneName = zone.getName();
+        } else {
+            zoneName = String.valueOf(zoneId);
+        }
+
+        Boolean natNow =  _bcfUtils.isNatEnabled();
+        if( natNow != null)
+        if (!nat && natNow){
+            throw new CloudRuntimeException("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first.");
+        } else if (nat && !natNow){
+            throw new CloudRuntimeException("NAT is disabled in existing controller. Disable NAT for new controller or remove existing controller first.");
+        }
+
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("guid", UUID.randomUUID().toString());
+        params.put("zoneId", zoneName);
+        params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId()));
+        params.put("name", "BigSwitch Controller - " + cmd.getHost());
+        params.put("hostname", cmd.getHost());
+        params.put("username", username);
+        params.put("password", password);
+        params.put("nat", nat.toString());
+
+        // FIXME What to do with multiple isolation types
+        params.put("transportzoneisotype", physicalNetwork.getIsolationMethods().get(0).toLowerCase());
+        Map<String, Object> hostdetails = new HashMap<String, Object>();
+        hostdetails.putAll(params);
+
+        try {
+            resource.configure(cmd.getHost(), hostdetails);
+
+            // store current topology in bcf resource
+            TopologyData topo = _bcfUtils.getTopology(physicalNetwork.getId());
+            ((BigSwitchBcfResource) resource).setTopology(topo);
+
+            final Host host = _resourceMgr.addHost(zoneId, resource, Host.Type.L2Networking, params);
+            if (host != null) {
+                newBcfDevice = Transaction.execute(new TransactionCallback<BigSwitchBcfDeviceVO>() {
+                    @Override
+                    public BigSwitchBcfDeviceVO doInTransaction(TransactionStatus status) {
+                        BigSwitchBcfDeviceVO bigswitchBcfDevice =
+                            new BigSwitchBcfDeviceVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(),
+                                    deviceName, hostname, username, password, nat, BigSwitchBcfApi.HASH_IGNORE);
+                        _bigswitchBcfDao.persist(bigswitchBcfDevice);
+
+                        DetailVO detail = new DetailVO(host.getId(), "bigswitchbcfdeviceid", String.valueOf(bigswitchBcfDevice.getId()));
+                        _hostDetailsDao.persist(detail);
+
+                        return bigswitchBcfDevice;
+                    }
+                });
+            } else {
+                throw new CloudRuntimeException("Failed to add BigSwitch BCF Controller Device due to internal error.");
+            }
+        } catch (ConfigurationException e) {
+            throw new CloudRuntimeException(e.getMessage());
+        }
+
+        // initial topology sync to newly added BCF controller
+        HostVO bigswitchBcfHost = _hostDao.findById(newBcfDevice.getHostId());
+        _bcfUtils.syncTopologyToBcfHost(bigswitchBcfHost, nat);
+
+        return newBcfDevice;
+    }
+
+    @Override
+    public BigSwitchBcfDeviceResponse createBigSwitchBcfDeviceResponse(BigSwitchBcfDeviceVO bigswitchBcfDeviceVO) {
+        HostVO bigswitchBcfHost = _hostDao.findById(bigswitchBcfDeviceVO.getHostId());
+        _hostDao.loadDetails(bigswitchBcfHost);
+
+        BigSwitchBcfDeviceResponse response = new BigSwitchBcfDeviceResponse();
+        response.setDeviceName(bigswitchBcfDeviceVO.getDeviceName());
+        PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(bigswitchBcfDeviceVO.getPhysicalNetworkId());
+        if (pnw != null) {
+            response.setPhysicalNetworkId(pnw.getUuid());
+        }
+        response.setId(bigswitchBcfDeviceVO.getUuid());
+        response.setProviderName(bigswitchBcfDeviceVO.getProviderName());
+        response.setHostName(bigswitchBcfHost.getDetail("hostname"));
+        response.setObjectName("bigswitchbcfdevice");
+        return response;
+    }
+
+    @Override
+    public boolean deleteBigSwitchBcfDevice(DeleteBigSwitchBcfDeviceCmd cmd) {
+        Long bigswitchBcfDeviceId = cmd.getBigSwitchBcfDeviceId();
+        BigSwitchBcfDeviceVO bigswitchBcfDevice = _bigswitchBcfDao.findById(bigswitchBcfDeviceId);
+        if (bigswitchBcfDevice == null) {
+            throw new InvalidParameterValueException("Could not find a BigSwitch Controller with id " + bigswitchBcfDevice);
+        }
+
+        HostVO bigswitchHost = _hostDao.findById(bigswitchBcfDevice.getHostId());
+        Long hostId = bigswitchHost.getId();
+
+        bigswitchHost.setResourceState(ResourceState.Maintenance);
+        _hostDao.update(hostId, bigswitchHost);
+        _resourceMgr.deleteHost(hostId, false, false);
+
+        _bigswitchBcfDao.remove(bigswitchBcfDeviceId);
+        return true;
+    }
+
+    @Override
+    public List<BigSwitchBcfDeviceVO> listBigSwitchBcfDevices(ListBigSwitchBcfDevicesCmd cmd) {
+        Long physicalNetworkId = cmd.getPhysicalNetworkId();
+        Long bigswitchBcfDeviceId = cmd.getBigSwitchBcfDeviceId();
+        List<BigSwitchBcfDeviceVO> responseList = new ArrayList<BigSwitchBcfDeviceVO>();
+
+        if (physicalNetworkId == null && bigswitchBcfDeviceId == null) {
+            throw new InvalidParameterValueException("Either physical network Id or bigswitch device Id must be specified");
+        }
+
+        if (bigswitchBcfDeviceId != null) {
+            BigSwitchBcfDeviceVO bigswitchBcfDevice = _bigswitchBcfDao.findById(bigswitchBcfDeviceId);
+            if (bigswitchBcfDevice == null) {
+                throw new InvalidParameterValueException("Could not find BigSwitch controller with id: " + bigswitchBcfDevice);
+            }
+            responseList.add(bigswitchBcfDevice);
+        } else {
+            PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
+            if (physicalNetwork == null) {
+                throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
+            }
+            responseList = _bigswitchBcfDao.listByPhysicalNetwork(physicalNetworkId);
+        }
+
+        return responseList;
+    }
+
+    @Override
+    public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
+        return null;
+    }
+
+    @Override
+    public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
+        if (!(startup[0] instanceof StartupBigSwitchBcfCommand)) {
+            return null;
+        }
+
+        BigSwitchBcfResource bcfResource = (BigSwitchBcfResource) resource;
+        bcfUtilsInit();
+
+        if(_bcfUtils.getTopology()!=null){
+            bcfResource.setTopology(_bcfUtils.getTopology());
+        }
+
+        host.setType(Host.Type.L2Networking);
+        return host;
+    }
+
+    @Override
+    public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException {
+        if (!(host.getType() == Host.Type.L2Networking)) {
+            return null;
+        }
+        return new DeleteHostAnswer(true);
+    }
+
+    @Override
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(AddBigSwitchBcfDeviceCmd.class);
+        cmdList.add(DeleteBigSwitchBcfDeviceCmd.class);
+        cmdList.add(ListBigSwitchBcfDevicesCmd.class);
+        return cmdList;
+    }
+
+    @Override
+    public IpDeployer getIpDeployer(Network network) {
+        return this;
+    }
+
+    @Override
+    public boolean applyStaticNats(Network network,
+            List<? extends StaticNat> rules)
+            throws ResourceUnavailableException {
+        bcfUtilsInit();
+
+        _bcfUtils.listACLbyNetwork(network);
+
+        Vpc vpc = null;
+        if(network.getVpcId()!=null){
+            vpc = _vpcDao.acquireInLockTable(network.getVpcId());
+        }
+
+        String tenantId;
+        if (vpc != null) {
+            tenantId = vpc.getUuid();
+            _vpcDao.releaseFromLockTable(vpc.getId());
+        } else {
+            // use account in CS as tenant in BSN
+            // use network uuid as tenantId for non-VPC networks
+            tenantId = network.getUuid();
+        }
+
+        for (StaticNat rule: rules){
+            String srcIp = _ipAddressDao.findById(rule.getSourceIpAddressId()).getAddress().addr();
+            String dstIp = rule.getDestIpAddress();
+            String mac = rule.getSourceMacAddress();
+            if(!rule.isForRevoke()) {
+                s_logger.debug("BCF enables static NAT for public IP: " + srcIp + " private IP " + dstIp
+                        + " mac " + mac);
+                CreateBcfStaticNatCommand cmd = new CreateBcfStaticNatCommand(
+                        tenantId, network.getUuid(), dstIp, srcIp, mac);
+
+                _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+            } else {
+                s_logger.debug("BCF removes static NAT for public IP: " + srcIp + " private IP " + dstIp
+                        + " mac " + mac);
+                DeleteBcfStaticNatCommand cmd = new DeleteBcfStaticNatCommand(tenantId, srcIp);
+
+                _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean applyIps(Network network,
+            List<? extends PublicIpAddress> ipAddress, Set<Service> services)
+            throws ResourceUnavailableException {
+        return false;
+    }
+
+    @Override
+    public boolean applyNetworkACLs(Network network,
+            List<? extends NetworkACLItem> rules)
+            throws ResourceUnavailableException {
+        SubnetUtils utils;
+        String cidr = null;
+        List<String> cidrList;
+        for(NetworkACLItem r: rules){
+            if(r.getState()==NetworkACLItem.State.Revoke){
+                continue;
+            }
+            cidrList = r.getSourceCidrList();
+            if(cidrList != null){
+                if(cidrList.size()>1 || r.getSourcePortEnd()!=r.getSourcePortStart()){
+                    throw new ResourceUnavailableException("One CIDR and one port only please.",
+                            Network.class, network.getId());
+                } else {
+                    cidr = cidrList.get(0);
+                }
+            }
+            if (cidr == null || cidr.equalsIgnoreCase("0.0.0.0/0")) {
+                cidr = "";
+            } else {
+                utils = new SubnetUtils(cidr);
+                if(!utils.getInfo().getNetworkAddress().equals(utils.getInfo().getAddress())){
+                    throw new ResourceUnavailableException("Invalid CIDR in Network ACL rule.",
+                            Network.class, network.getId());
+                }
+            }
+        }
+        updateBcfRouter(network);
+        return true;
+    }
+
+    @Override
+    public boolean applyFWRules(Network network,
+            List<? extends FirewallRule> rules)
+            throws ResourceUnavailableException {
+        SubnetUtils utils;
+        String cidr = null;
+        List<String> cidrList;
+        for(FirewallRule r: rules){
+            if(r.getState()==FirewallRule.State.Revoke){
+                continue;
+            }
+            cidrList = r.getSourceCidrList();
+            if(cidrList != null){
+                if(cidrList.size()>1 || r.getSourcePortEnd()!=r.getSourcePortStart()){
+                    throw new ResourceUnavailableException("One CIDR and one port only please.",
+                            Network.class, network.getId());
+                } else {
+                    cidr = cidrList.get(0);
+                }
+            }
+            if (cidr == null || cidr.equalsIgnoreCase("0.0.0.0/0")) {
+                cidr = "";
+            } else {
+                utils = new SubnetUtils(cidr);
+                if(!utils.getInfo().getNetworkAddress().equals(utils.getInfo().getAddress())){
+                    throw new ResourceUnavailableException("Invalid CIDR in Firewall rule.",
+                            Network.class, network.getId());
+                }
+            }
+        }
+        updateBcfRouter(network);
+        return true;
+    }
+
+    private void updateBcfRouter(Network network) throws IllegalArgumentException{
+        bcfUtilsInit();
+
+        Vpc vpc = null;
+        if(network.getVpcId()!=null){
+            vpc = _vpcDao.acquireInLockTable(network.getVpcId());
+        }
+
+        String tenantId;
+        if (vpc != null) {
+            tenantId = vpc.getUuid();
+            _vpcDao.releaseFromLockTable(vpc.getId());
+        } else {
+            tenantId = network.getUuid();
+        }
+
+        UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand(tenantId);
+
+        List<AclData> aclList = _bcfUtils.listACLbyNetwork(network);
+        for(AclData acl: aclList){
+            cmd.addAcl(acl);
+        }
+
+        if(vpc != null){
+            cmd.setPublicIp(_bcfUtils.getPublicIpByVpc(vpc));
+        } else {
+            cmd.setPublicIp(_bcfUtils.getPublicIpByNetwork(network));
+        }
+
+        BcfAnswer answer = _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+        if(answer != null && !answer.getResult()){
+            throw new IllegalArgumentException("Illegal router update arguments");
+        }
+    }
+
+    private void bcfUtilsInit(){
+        if (_bcfUtils == null) {
+            _bcfUtils = new BigSwitchBcfUtils(_networkDao, _nicDao,
+                    _vmDao, _hostDao, _vpcDao, _bigswitchBcfDao,
+                    _agentMgr, _vlanDao, _ipAddressDao, _fwRulesDao,
+                    _fwCidrsDao, _aclItemDao, _aclItemCidrsDao, _networkModel);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElementService.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElementService.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElementService.java
new file mode 100644
index 0000000..3a64472
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElementService.java
@@ -0,0 +1,41 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.element;
+
+import java.util.List;
+
+import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd;
+import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd;
+import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd;
+import com.cloud.api.response.BigSwitchBcfDeviceResponse;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.utils.component.PluggableService;
+
+public interface BigSwitchBcfElementService extends PluggableService {
+
+    public BigSwitchBcfDeviceVO addBigSwitchBcfDevice(AddBigSwitchBcfDeviceCmd cmd);
+
+    public BigSwitchBcfDeviceResponse createBigSwitchBcfDeviceResponse(BigSwitchBcfDeviceVO bigswitchDeviceVO);
+
+    public boolean deleteBigSwitchBcfDevice(DeleteBigSwitchBcfDeviceCmd cmd);
+
+    public List<BigSwitchBcfDeviceVO> listBigSwitchBcfDevices(ListBigSwitchBcfDevicesCmd cmd);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01864ef7/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java b/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java
new file mode 100644
index 0000000..7625b4b
--- /dev/null
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java
@@ -0,0 +1,423 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.network.guru;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.CreateBcfAttachmentCommand;
+import com.cloud.agent.api.CreateBcfRouterCommand;
+import com.cloud.agent.api.CreateBcfRouterInterfaceCommand;
+import com.cloud.agent.api.CreateBcfSegmentCommand;
+import com.cloud.agent.api.DeleteBcfSegmentCommand;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.deploy.DeployDestination;
+import com.cloud.deploy.DeploymentPlan;
+import com.cloud.event.ActionEventUtils;
+import com.cloud.event.EventTypes;
+import com.cloud.event.EventVO;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.BigSwitchBcfDeviceVO;
+import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.State;
+import com.cloud.network.NetworkMigrationResponder;
+import com.cloud.network.NetworkProfile;
+import com.cloud.network.NetworkService;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
+import com.cloud.network.bigswitch.BigSwitchBcfUtils;
+import com.cloud.network.dao.BigSwitchBcfDao;
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkVO;
+import com.cloud.network.vpc.NetworkACLItemCidrsDao;
+import com.cloud.network.vpc.NetworkACLItemDao;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.user.Account;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.dao.DomainRouterDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+/**
+ * BigSwitchBcfGuestNetworkGuru is responsible for creating and removing virtual networks.
+ * Current implementation leverages GuestNetworkGuru to create VLAN based virtual networks
+ * and map it to a Big Switch Big Cloud Fabric (BCF) Segment.  It is called by the NetworkOrchestrator.
+ *
+ * When a VM is created and needs to be plugged into a BCF segment network, BigSwitchBcfElement is
+ * called by NetworkOrchestrator to create a "port" and an "attachment" for each nic, and
+ * register them with the controller to be plugged into the corresponding network. It also
+ * removes them when the VM is destroyed.
+ */
+@Local(value = NetworkGuru.class)
+public class BigSwitchBcfGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigrationResponder {
+    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfGuestNetworkGuru.class);
+
+    @Inject
+    PhysicalNetworkDao _physicalNetworkDao;
+    @Inject
+    BigSwitchBcfDao _bigswitchBcfDao;
+    @Inject
+    HostDao _hostDao;
+    @Inject
+    AgentManager _agentMgr;
+    @Inject
+    DomainRouterDao _routerDao;
+    @Inject
+    VMInstanceDao _vmDao;
+    @Inject
+    AccountDao _accountDao;
+    @Inject
+    VpcDao _vpcDao;
+    @Inject
+    IPAddressDao _ipAddressDao;
+    @Inject
+    HostPodDao _podDao;
+    @Inject
+    NetworkService _netService;
+    @Inject
+    VlanDao _vlanDao;
+    @Inject
+    FirewallRulesDao _fwRulesDao;
+    @Inject
+    FirewallRulesCidrsDao _fwCidrsDao;
+    @Inject
+    NetworkACLItemDao _aclItemDao;
+    @Inject
+    NetworkACLItemCidrsDao _aclItemCidrsDao;
+
+    private BigSwitchBcfUtils _bcfUtils = null;
+
+    public BigSwitchBcfGuestNetworkGuru() {
+        super();
+        _isolationMethods = new IsolationMethod[] {IsolationMethod.BCF_SEGMENT};
+    }
+
+    @Override
+    protected boolean canHandle(NetworkOffering offering, NetworkType networkType, PhysicalNetwork physicalNetwork) {
+        if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == Network.GuestType.Isolated &&
+            isMyIsolationMethod(physicalNetwork)) {
+            return true;
+        } else {
+            s_logger.trace("We only take care of Guest networks of type   " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
+            return false;
+        }
+    }
+
+    @Override
+    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
+        // Check if the isolation type of the physical network is BCF_SEGMENT, then delegate GuestNetworkGuru to design
+        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
+        if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("BCF_SEGMENT")) {
+            s_logger.debug("Refusing to design this network, the physical isolation type is not BCF_SEGMENT");
+            return null;
+        }
+
+        List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listByPhysicalNetwork(physnet.getId());
+        if (devices.isEmpty()) {
+            s_logger.error("No BigSwitch Controller on physical network " + physnet.getName());
+            return null;
+        }
+        for (BigSwitchBcfDeviceVO d: devices){
+            s_logger.debug("BigSwitch Controller " + d.getUuid()
+                    + " found on physical network " + physnet.getId());
+        }
+
+        s_logger.debug("Physical isolation type is BCF_SEGMENT, asking GuestNetworkGuru to design this network");
+        NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner);
+        if (networkObject == null) {
+            return null;
+        }
+        // Override the broadcast domain type
+        networkObject.setBroadcastDomainType(BroadcastDomainType.Vlan);
+
+        return networkObject;
+    }
+
+    @Override
+    public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
+        throws InsufficientVirtualNetworkCapacityException {
+        assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
+
+        bcfUtilsInit();
+
+        long dcId = dest.getDataCenter().getId();
+
+        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
+
+        NetworkVO implemented =
+            new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
+                network.getDataCenterId(), physicalNetworkId, false);
+
+        if (network.getGateway() != null) {
+            implemented.setGateway(network.getGateway());
+        }
+
+        if (network.getCidr() != null) {
+            implemented.setCidr(network.getCidr());
+        }
+
+        String vnetId = "";
+        if (network.getBroadcastUri() == null) {
+            vnetId = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), context.getReservationId(), UseSystemGuestVlans.valueIn(network.getAccountId()));
+            if (vnetId == null) {
+                throw new InsufficientVirtualNetworkCapacityException("Unable to allocate vnet as a " +
+                        "part of network " + network + " implement ", DataCenter.class, dcId);
+            }
+            implemented.setBroadcastUri(BroadcastDomainType.Vlan.toUri(vnetId));
+            ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), network.getAccountId(),
+                    EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone Vlan: " + vnetId + " Network Id: " + network.getId(), 0);
+        } else {
+            implemented.setBroadcastUri(network.getBroadcastUri());
+        }
+
+        // Name is either the given name or the uuid
+        String name = network.getName();
+        if (name == null || name.isEmpty()) {
+            name = ((NetworkVO)network).getUuid();
+        }
+        if (name.length() > 64) {
+            name = name.substring(0, 63); // max length 64
+        }
+
+        // update fields in network object
+        NetworkVO networkObject = (NetworkVO) network;
+
+        // determine whether this is VPC network or stand-alone network
+        Vpc vpc = null;
+        if(network.getVpcId()!=null){
+            vpc = _vpcDao.acquireInLockTable(network.getVpcId());
+        }
+
+        // use uuid of networkVO as network id in BSN
+        String networkId = networkObject.getUuid();
+
+        String tenantId;
+        String tenantName;
+        if (vpc != null) {
+            tenantId = vpc.getUuid();
+            tenantName = vpc.getName();
+            _vpcDao.releaseFromLockTable(vpc.getId());
+        } else {
+            // use network in CS as tenant in BSN
+            // for non-VPC networks, use network name and id as tenant name and id
+            tenantId = networkId;
+            tenantName = name;
+        }
+
+        // store tenantId in networkObject for NetworkOrchestrator implementNetwork use
+        networkObject.setNetworkDomain(tenantId);
+        // store tenant Id in implemented object for future actions (e.g., shutdown)
+        implemented.setNetworkDomain(tenantId);
+        String vlanStr = BroadcastDomainType.getValue(implemented.getBroadcastUri());
+
+        // get public net info - needed to set up source nat gateway
+        NetworkVO pubNet = _bcfUtils.getPublicNetwork(physicalNetworkId);
+
+        // locate subnet info
+        SearchCriteria<VlanVO> sc = _vlanDao.createSearchCriteria();
+        sc.setParameters("network_id", pubNet.getId());
+        VlanVO pubVlanVO = _vlanDao.findOneBy(sc);
+        String pubVlanStr = pubVlanVO.getVlanTag();
+
+        Integer vlan;
+        if(StringUtils.isNumeric(vlanStr)){
+            vlan = Integer.valueOf(vlanStr);
+        } else {
+            vlan = 0;
+        }
+        CreateBcfSegmentCommand cmd1 = new CreateBcfSegmentCommand(tenantId, tenantName, networkId, name, vlan);
+
+        _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd1, networkObject);
+
+        if(_bcfUtils.isNatEnabled()){
+            Integer pvlan;
+            if(StringUtils.isNumeric(pubVlanStr)){
+                pvlan = Integer.valueOf(pubVlanStr);
+            } else {
+                pvlan = 0;
+            }
+            CreateBcfSegmentCommand cmd2 = new CreateBcfSegmentCommand("external", "external", "external", "external", pvlan);
+
+            _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd2, networkObject);
+
+            CreateBcfRouterCommand cmd3 = new CreateBcfRouterCommand(tenantId);
+
+            _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd3, network);
+
+            CreateBcfRouterInterfaceCommand cmd5 = new CreateBcfRouterInterfaceCommand(tenantId, network.getUuid(), network.getCidr(),
+                    network.getGateway(), network.getName());
+
+            _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd5, network);
+        }
+        return implemented;
+    }
+
+
+
+    @Override
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
+        throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
+        // Have GuestNetworkGuru reserve for us
+        super.reserve(nic, network, vm, dest, context);
+    }
+
+    @Override
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
+        return super.release(nic, vm, reservationId);
+    }
+
+    @Override
+    public void shutdown(NetworkProfile profile, NetworkOffering offering) {
+        NetworkVO networkObject = _networkDao.findById(profile.getId());
+        if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vlan || networkObject.getBroadcastUri() == null) {
+            s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
+            return;
+        }
+
+        bcfUtilsInit();
+
+        // tenantId stored in network domain field at creation
+        String tenantId = networkObject.getNetworkDomain();
+
+        String networkId = networkObject.getUuid();
+
+        DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand(tenantId, networkId);
+
+        _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, networkObject);
+
+        super.shutdown(profile, offering);
+    }
+
+    @Override
+    public boolean trash(Network network, NetworkOffering offering) {
+        return super.trash(network, offering);
+    }
+
+    @Override
+    public boolean prepareMigration(NicProfile nic, Network network,
+            VirtualMachineProfile vm, DeployDestination dest,
+            ReservationContext context) {
+        bcfUtilsInit();
+
+        // get arguments for CreateBcfAttachmentCommand
+        // determine whether this is VPC network or stand-alone network
+        Vpc vpc = null;
+        if(network.getVpcId()!=null){
+            vpc = _vpcDao.acquireInLockTable(network.getVpcId());
+        }
+
+        String networkId = network.getUuid();
+
+        String tenantId;
+        String tenantName;
+        if (vpc != null) {
+            tenantId = vpc.getUuid();
+            tenantName = vpc.getName();
+            boolean released = _vpcDao.releaseFromLockTable(vpc.getId());
+            s_logger.debug("BCF guru release lock vpc id: " + vpc.getId()
+                    + " released? " + released);
+        } else {
+            // use network id in CS as tenant in BSN
+            // use network uuid as tenant id for non-VPC networks
+            tenantId = networkId;
+            tenantName = network.getName();
+        }
+
+        String hostname = dest.getHost().getName();
+        long zoneId = network.getDataCenterId();
+        String vmwareVswitchLabel = _networkModel.getDefaultGuestTrafficLabel(zoneId, HypervisorType.VMware);
+        String[] labelArray = null;
+        String vswitchName = null;
+        if(vmwareVswitchLabel!=null){
+            labelArray=vmwareVswitchLabel.split(",");
+            vswitchName = labelArray[0];
+        }
+
+        // hypervisor type:
+        //   kvm: ivs port name
+        //   vmware: specific portgroup naming convention
+        String pgName = "";
+        if (dest.getHost().getHypervisorType() == HypervisorType.KVM){
+            pgName = hostname;
+        } else if (dest.getHost().getHypervisorType() == HypervisorType.VMware){
+            pgName = hostname + "-" + vswitchName;
+        }
+
+        String nicId = nic.getUuid();
+        Integer vlan = Integer.valueOf(BroadcastDomainType.getValue(nic.getIsolationUri()));
+        String ipv4 = nic.getIp4Address();
+        String mac = nic.getMacAddress();
+
+        CreateBcfAttachmentCommand cmd = new CreateBcfAttachmentCommand(tenantId,
+                tenantName, networkId, pgName, nicId, vlan, ipv4, mac);
+
+        _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, network);
+
+        return true;
+    }
+
+    @Override
+    public void rollbackMigration(NicProfile nic, Network network,
+            VirtualMachineProfile vm, ReservationContext src,
+            ReservationContext dst) {
+        s_logger.debug("BCF guru rollback migration");
+    }
+
+    @Override
+    public void commitMigration(NicProfile nic, Network network,
+            VirtualMachineProfile vm, ReservationContext src,
+            ReservationContext dst) {
+        s_logger.debug("BCF guru commit migration");
+    }
+
+    private void bcfUtilsInit(){
+        if (_bcfUtils == null) {
+            _bcfUtils = new BigSwitchBcfUtils(_networkDao, _nicDao,
+                    _vmDao, _hostDao, _vpcDao, _bigswitchBcfDao,
+                    _agentMgr, _vlanDao, _ipAddressDao, _fwRulesDao,
+                    _fwCidrsDao, _aclItemDao, _aclItemCidrsDao, _networkModel);
+        }
+    }
+}


[51/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java b/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
index c5407bc..a43cad3 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/resource/BigSwitchBcfResource.java
@@ -312,7 +312,7 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
             return new BcfAnswer(cmd, true, "Segment " + network.getNetwork().getId() + " created", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "Segment " + network.getNetwork().getId() + " created; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -327,11 +327,11 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
 
     private Answer executeRequest(DeleteBcfSegmentCommand cmd, int numRetries) {
         try {
-            String hash = _bigswitchBcfApi.deleteNetwork(cmd.get_tenantUuid(), cmd.getNetworkUuid());
+            String hash = _bigswitchBcfApi.deleteNetwork(cmd.getTenantUuid(), cmd.getNetworkUuid());
             return new BcfAnswer(cmd, true, "Segment " + cmd.getNetworkUuid() + " deleted", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "Segment " + cmd.getNetworkUuid() + " deleted; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -357,7 +357,7 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
             return new BcfAnswer(cmd, true, "network attachment " + cmd.getPortId() + " created", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "network attachment " + cmd.getPortId() + " created; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -376,7 +376,7 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
             return new BcfAnswer(cmd, true, "network attachment " + nicName + " deleted", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "network attachment " + nicName + " deleted; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -398,7 +398,7 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
             return new BcfAnswer(cmd, true, "Network attachment  " + cmd.getAttachmentId() + " updated", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "Network attachment  " + cmd.getAttachmentId() + " updated; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -412,21 +412,21 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
 
     private Answer executeRequest(CreateBcfStaticNatCommand cmd, int numRetries) {
         FloatingIpData fip = new FloatingIpData();
-        fip.setTenantId(cmd.get_tenantId());
-        fip.setNetworkId(cmd.get_networkId());
-        fip.setFixedIp(cmd.get_privateIp());
-        fip.setFloatingIpAndId(cmd.get_publicIp());
-        fip.setMac(cmd.get_mac());
+        fip.setTenantId(cmd.getTenantId());
+        fip.setNetworkId(cmd.getNetworkId());
+        fip.setFixedIp(cmd.getPrivateIp());
+        fip.setFloatingIpAndId(cmd.getPublicIp());
+        fip.setMac(cmd.getMac());
 
         try {
-            String hash = _bigswitchBcfApi.createFloatingIp(cmd.get_tenantId(), fip);
-            return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + ":" +
-                    cmd.get_privateIp() + " created", hash);
+            String hash = _bigswitchBcfApi.createFloatingIp(cmd.getTenantId(), fip);
+            return new BcfAnswer(cmd, true, "floating ip " + cmd.getPublicIp() + ":" +
+                    cmd.getPrivateIp() + " created", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
-                return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + ":" +
-                        cmd.get_privateIp() + " created; topology sync required.");
+                cmd.setTopologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "floating ip " + cmd.getPublicIp() + ":" +
+                        cmd.getPrivateIp() + " created; topology sync required.");
             } else {
                 if (numRetries > 0) {
                     return retry(cmd, --numRetries);
@@ -439,12 +439,12 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
 
     private Answer executeRequest(DeleteBcfStaticNatCommand cmd, int numRetries) {
         try {
-            String hash = _bigswitchBcfApi.deleteFloatingIp(cmd.get_tenantId(), cmd.get_floatingIpId());
-            return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + " deleted", hash);
+            String hash = _bigswitchBcfApi.deleteFloatingIp(cmd.getTenantId(), cmd.getFloatingIpId());
+            return new BcfAnswer(cmd, true, "floating ip " + cmd.getPublicIp() + " deleted", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
-                return new BcfAnswer(cmd, true, "floating ip " + cmd.get_publicIp() + " deleted; topology sync required.");
+                cmd.setTopologySyncRequested(true);
+                return new BcfAnswer(cmd, true, "floating ip " + cmd.getPublicIp() + " deleted; topology sync required.");
             } else {
                 if (numRetries > 0) {
                     return retry(cmd, --numRetries);
@@ -456,16 +456,16 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
     }
 
     private Answer executeRequest(CreateBcfRouterCommand cmd, int numRetries) {
-        RouterData router = new RouterData(cmd.get_tenantId());
+        RouterData router = new RouterData(cmd.getTenantId());
         try {
             String hash;
-            hash = _bigswitchBcfApi.createRouter(cmd.get_tenantId(), router);
+            hash = _bigswitchBcfApi.createRouter(cmd.getTenantId(), router);
 
-            return new BcfAnswer(cmd, true, "router " + cmd.get_tenantId() +
+            return new BcfAnswer(cmd, true, "router " + cmd.getTenantId() +
                     " created.", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, " created; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -478,18 +478,18 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
     }
 
     private Answer executeRequest(CreateBcfRouterInterfaceCommand cmd, int numRetries) {
-        RouterInterfaceData routerInterface = new RouterInterfaceData(cmd.get_tenantId(),
-                cmd.get_gateway(), cmd.get_cidr(), cmd.get_networkId(), cmd.get_networkName());
+        RouterInterfaceData routerInterface = new RouterInterfaceData(cmd.getTenantId(),
+                cmd.getGateway(), cmd.getCidr(), cmd.getNetworkId(), cmd.getNetworkName());
         try {
             String hash;
-            hash = _bigswitchBcfApi.createRouterInterface(cmd.get_tenantId(),
-                    cmd.get_tenantId(), routerInterface);
+            hash = _bigswitchBcfApi.createRouterInterface(cmd.getTenantId(),
+                    cmd.getTenantId(), routerInterface);
 
-            return new BcfAnswer(cmd, true, "router " + cmd.get_tenantId() +
+            return new BcfAnswer(cmd, true, "router " + cmd.getTenantId() +
                     " created.", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, " created; topology sync required.");
             } else {
                 if (numRetries > 0) {
@@ -515,7 +515,7 @@ public class BigSwitchBcfResource extends ManagerBase implements ServerResource
             return new BcfAnswer(cmd, true, "tenant " + cmd.getTenantId() + " router updated", hash);
         } catch (BigSwitchBcfApiException e) {
             if (e.is_topologySyncRequested()) {
-                cmd.set_topologySyncRequested(true);
+                cmd.setTopologySyncRequested(true);
                 return new BcfAnswer(cmd, true, "tenant " + cmd.getTenantId() + " router updated but topology sync required.");
             } else {
                 if (numRetries > 0) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/scripts/util/qemu-ivs-ifup
----------------------------------------------------------------------
diff --git a/scripts/util/qemu-ivs-ifup b/scripts/util/qemu-ivs-ifup
index 6830d23..6c7b16f 100755
--- a/scripts/util/qemu-ivs-ifup
+++ b/scripts/util/qemu-ivs-ifup
@@ -6,9 +6,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-#
+# 
 #   http://www.apache.org/licenses/LICENSE-2.0
-#
+# 
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,5 +16,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/sbin/ifconfig $1 0.0.0.0 up
-/usr/sbin/ivs-ctl add-port $1
+/sbin/ifconfig $1 0.0.0.0 up 
+/usr/sbin/ivs-ctl add-port $1 


[41/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-6885: fix logrotate on VR to depend on size

In 6ac06e5e5e3ceed4a3e3a86ea5f82ffb59c266f2 logrotate was changed to run hourly.
Some logrotate configs still have set `daily` only which results in logs not
rotated hourly. The only way to ensure the log is rotated is to use size.

This closes #162

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0ada08aa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0ada08aa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0ada08aa

Branch: refs/heads/reporter
Commit: 0ada08aa85b305ef931298654f7b41a7db28b03b
Parents: 4a42450
Author: Rene Moser <re...@apache.org>
Authored: Mon Apr 13 17:59:13 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 14 00:49:28 2015 +0530

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/logrotate.d/apache2    | 2 +-
 systemvm/patches/debian/config/etc/logrotate.d/cloud      | 1 +
 systemvm/patches/debian/config/etc/logrotate.d/conntrackd | 1 +
 systemvm/patches/debian/config/etc/logrotate.d/dnsmasq    | 1 +
 systemvm/patches/debian/config/etc/logrotate.d/ppp        | 1 +
 5 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ada08aa/systemvm/patches/debian/config/etc/logrotate.d/apache2
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/apache2 b/systemvm/patches/debian/config/etc/logrotate.d/apache2
index 14c9675..3932c27 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/apache2
+++ b/systemvm/patches/debian/config/etc/logrotate.d/apache2
@@ -4,6 +4,6 @@
        rotate 3
        compress
        dateext
-       size=+10M
+       size 10M
        notifempty
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ada08aa/systemvm/patches/debian/config/etc/logrotate.d/cloud
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/cloud b/systemvm/patches/debian/config/etc/logrotate.d/cloud
index 5d95942..82801f1 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/cloud
+++ b/systemvm/patches/debian/config/etc/logrotate.d/cloud
@@ -17,6 +17,7 @@
 /var/log/cloud.log {
         rotate 4
         daily
+        size 10M
         missingok
         notifempty
         compress

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ada08aa/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
index 8139191..0229cd7 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
+++ b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
@@ -1,5 +1,6 @@
 /var/log/conntrackd-stats.log {
     daily
+    size 10M
     rotate 2
     missingok
     compress

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ada08aa/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq b/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
index 2654590..2f91785 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
+++ b/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
@@ -1,5 +1,6 @@
 /var/log/dnsmasq.log {
     daily
+    size 10M
     missingok
     rotate 5
     notifempty

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ada08aa/systemvm/patches/debian/config/etc/logrotate.d/ppp
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/ppp b/systemvm/patches/debian/config/etc/logrotate.d/ppp
index 7181bc3..2004e77 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/ppp
+++ b/systemvm/patches/debian/config/etc/logrotate.d/ppp
@@ -1,5 +1,6 @@
 /var/log/ppp-connect-errors {
 	daily
+	size 10M
 	rotate 5
 	missingok
 	notifempty


[52/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs and PMD fixes

This closes #168

Signed-off-by: Rajani Karuturi <ra...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/581f3b79
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/581f3b79
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/581f3b79

Branch: refs/heads/reporter
Commit: 581f3b79a362fde39c9c83cd72baef39a3f0c7a3
Parents: 9836ccd
Author: KC Wang <ku...@gmail.com>
Authored: Fri Sep 26 14:09:30 2014 -0700
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Wed Apr 15 11:30:04 2015 +0530

----------------------------------------------------------------------
 .../src/com/cloud/agent/api/BcfAnswer.java      |   6 +-
 .../src/com/cloud/agent/api/BcfCommand.java     |  14 +-
 .../agent/api/CacheBcfTopologyCommand.java      |   8 +-
 .../agent/api/CreateBcfAttachmentCommand.java   |  22 +--
 .../cloud/agent/api/CreateBcfRouterCommand.java |   4 +-
 .../api/CreateBcfRouterInterfaceCommand.java    |  14 +-
 .../agent/api/CreateBcfSegmentCommand.java      |  16 +-
 .../agent/api/CreateBcfStaticNatCommand.java    |  14 +-
 .../agent/api/DeleteBcfAttachmentCommand.java   |  10 +-
 .../agent/api/DeleteBcfSegmentCommand.java      |  10 +-
 .../agent/api/DeleteBcfStaticNatCommand.java    |   8 +-
 .../agent/api/GetControllerDataAnswer.java      |  25 +--
 .../agent/api/GetControllerDataCommand.java     |   2 -
 .../agent/api/GetControllerHostsAnswer.java     |   4 +-
 .../agent/api/GetControllerHostsCommand.java    |   4 +-
 .../cloud/agent/api/SyncBcfTopologyCommand.java |  14 +-
 .../agent/api/UpdateBcfAttachmentCommand.java   |  11 +-
 .../cloud/agent/api/UpdateBcfRouterCommand.java |  10 +-
 .../api/commands/AddBigSwitchBcfDeviceCmd.java  |  25 ++-
 .../com/cloud/api/commands/BcfConstants.java    |   8 +-
 .../commands/DeleteBigSwitchBcfDeviceCmd.java   |  16 +-
 .../commands/ListBigSwitchBcfDevicesCmd.java    |  22 +--
 .../response/BigSwitchBcfDeviceResponse.java    |  16 +-
 .../com/cloud/network/BigSwitchBcfDeviceVO.java |  10 +-
 .../com/cloud/network/bigswitch/AclData.java    |  28 +--
 .../cloud/network/bigswitch/AttachmentData.java |  31 ++--
 .../network/bigswitch/BigSwitchBcfApi.java      | 170 ++++++++++---------
 .../network/bigswitch/BigSwitchBcfUtils.java    |  14 +-
 .../network/element/BigSwitchBcfElement.java    |  17 +-
 .../network/resource/BigSwitchBcfResource.java  |  64 +++----
 scripts/util/qemu-ivs-ifup                      |   8 +-
 31 files changed, 314 insertions(+), 311 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
index d144386..45bb024 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java
@@ -22,17 +22,17 @@ package com.cloud.agent.api;
 public class BcfAnswer extends Answer{
     private final String hash;
 
-    public BcfAnswer(Command command, boolean success, String details) {
+    public BcfAnswer(final Command command, final boolean success, final String details) {
         super(command, success, details);
         this.hash = "";
     }
 
-    public BcfAnswer(Command command, boolean success, String details, String hash) {
+    public BcfAnswer(final Command command, final boolean success, final String details, final String hash) {
         super(command, success, details);
         this.hash = hash;
     }
 
-    public BcfAnswer(Command command, Exception e) {
+    public BcfAnswer(final Command command, final Exception e) {
         super(command, e);
         this.hash = "";
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
index b245945..6e08dad 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java
@@ -22,8 +22,8 @@ package com.cloud.agent.api;
 import com.cloud.network.bigswitch.TopologyData;
 
 public class BcfCommand extends Command {
-    private TopologyData topology = null;
-    private boolean _topologySyncRequested = false;
+    private TopologyData topology;
+    private boolean topologySyncRequested;
 
     @Override
     public boolean executeInSequence() {
@@ -34,15 +34,15 @@ public class BcfCommand extends Command {
         return topology;
     }
 
-    public void setTopology(TopologyData topology) {
+    public void setTopology(final TopologyData topology) {
         this.topology = topology;
     }
 
-    public boolean is_topologySyncRequested() {
-        return _topologySyncRequested;
+    public boolean isTopologySyncRequested() {
+        return topologySyncRequested;
     }
 
-    public void set_topologySyncRequested(boolean requested) {
-        this._topologySyncRequested = requested;
+    public void setTopologySyncRequested(final boolean requested) {
+        this.topologySyncRequested = requested;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
index 39e7b66..1ab22a5 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java
@@ -22,10 +22,10 @@ package com.cloud.agent.api;
 import com.cloud.network.bigswitch.TopologyData;
 
 public class CacheBcfTopologyCommand extends Command{
-    private final TopologyData topology;
+    private final TopologyData _topology;
 
-    public CacheBcfTopologyCommand(TopologyData topology){
-        this.topology = topology;
+    public CacheBcfTopologyCommand(final TopologyData topology){
+        this._topology = topology;
     }
 
     @Override
@@ -34,6 +34,6 @@ public class CacheBcfTopologyCommand extends Command{
     }
 
     public TopologyData getTopology() {
-        return topology;
+        return _topology;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
index 97d56a5..74e1215 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java
@@ -20,18 +20,18 @@
 package com.cloud.agent.api;
 
 public class CreateBcfAttachmentCommand extends BcfCommand {
-    private String _tenantId;
-    private String _tenantName;
-    private String _networkId;
-    private String _portId;
-    private String _nicId;
-    private Integer _vlan;
-    private String _ipv4;
-    private String _mac;
+    private final String _tenantId;
+    private final String _tenantName;
+    private final String _networkId;
+    private final String _portId;
+    private final String _nicId;
+    private final Integer _vlan;
+    private final String _ipv4;
+    private final String _mac;
 
-    public CreateBcfAttachmentCommand(String tenantId, String tenantName,
-            String networkId, String portId, String nicId,
-            Integer vlan, String ipv4, String mac) {
+    public CreateBcfAttachmentCommand(final String tenantId, final String tenantName,
+            final String networkId, final String portId, final String nicId,
+            final Integer vlan, final String ipv4, final String mac) {
         this._tenantId = tenantId;
         this._tenantName = tenantName;
         this._networkId = networkId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
index 4379ed4..8fcab6b 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java
@@ -22,11 +22,11 @@ package com.cloud.agent.api;
 public class CreateBcfRouterCommand extends BcfCommand {
     private final String _tenantId;
 
-    public CreateBcfRouterCommand(String tenantId){
+    public CreateBcfRouterCommand(final String tenantId){
         this._tenantId = tenantId;
     }
 
-    public String get_tenantId() {
+    public String getTenantId() {
         return _tenantId;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
index 4b8d227..66ad1a0 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java
@@ -26,8 +26,8 @@ public class CreateBcfRouterInterfaceCommand extends BcfCommand{
     private final String _gateway;
     private final String _networkName;
 
-    public CreateBcfRouterInterfaceCommand(String tenantId, String networkId, String cidr,
-            String gateway, String networkName){
+    public CreateBcfRouterInterfaceCommand(final String tenantId, final String networkId,
+            final String cidr, final String gateway, final String networkName){
         this._tenantId = tenantId;
         this._networkId = networkId;
         this._networkName = networkName;
@@ -35,23 +35,23 @@ public class CreateBcfRouterInterfaceCommand extends BcfCommand{
         this._gateway = gateway;
     }
 
-    public String get_tenantId() {
+    public String getTenantId() {
         return _tenantId;
     }
 
-    public String get_networkId() {
+    public String getNetworkId() {
         return _networkId;
     }
 
-    public String get_networkName() {
+    public String getNetworkName() {
         return _networkName;
     }
 
-    public String get_cidr() {
+    public String getCidr() {
         return _cidr;
     }
 
-    public String get_gateway() {
+    public String getGateway() {
         return _gateway;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
index d54dac6..9bb75fe 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java
@@ -20,14 +20,14 @@
 package com.cloud.agent.api;
 
 public class CreateBcfSegmentCommand extends BcfCommand {
-    private String _tenantId;
-    private String _tenantName;
-    private String _networkId;
-    private String _networkName;
-    private Integer _vlan;
-
-    public CreateBcfSegmentCommand(String tenantId, String tenantName,
-            String networkId, String networkName, Integer vlan) {
+    private final String _tenantId;
+    private final String _tenantName;
+    private final String _networkId;
+    private final String _networkName;
+    private final Integer _vlan;
+
+    public CreateBcfSegmentCommand(final String tenantId, final String tenantName,
+            final String networkId, final String networkName, final Integer vlan) {
         this._tenantId = tenantId;
         this._tenantName = tenantName;
         this._networkId = networkId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
index 917f480..3db96f1 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java
@@ -26,8 +26,8 @@ public class CreateBcfStaticNatCommand extends BcfCommand {
     private final String _publicIp;
     private final String _mac;
 
-    public CreateBcfStaticNatCommand(String tenantId, String networkId,
-            String privateIp, String publicIp, String mac){
+    public CreateBcfStaticNatCommand(final String tenantId, final String networkId,
+            final String privateIp, final String publicIp, final String mac){
         this._tenantId = tenantId;
         this._networkId = networkId;
         this._privateIp = privateIp;
@@ -35,23 +35,23 @@ public class CreateBcfStaticNatCommand extends BcfCommand {
         this._mac = mac;
     }
 
-    public String get_tenantId() {
+    public String getTenantId() {
         return _tenantId;
     }
 
-    public String get_networkId() {
+    public String getNetworkId() {
         return _networkId;
     }
 
-    public String get_privateIp() {
+    public String getPrivateIp() {
         return _privateIp;
     }
 
-    public String get_publicIp() {
+    public String getPublicIp() {
         return _publicIp;
     }
 
-    public String get_mac() {
+    public String getMac() {
         return _mac;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
index d5cf13f..fc9f05f 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java
@@ -20,12 +20,12 @@
 package com.cloud.agent.api;
 
 public class DeleteBcfAttachmentCommand extends BcfCommand {
-    private String _tenantId;
-    private String _networkId;
-    private String _attachmentId;
+    private final String _tenantId;
+    private final String _networkId;
+    private final String _attachmentId;
 
-    public DeleteBcfAttachmentCommand(String tenantId,
-            String networkId, String attachmentId) {
+    public DeleteBcfAttachmentCommand(final String tenantId,
+            final String networkId, final String attachmentId) {
         this._tenantId = tenantId;
         this._networkId = networkId;
         this._attachmentId = attachmentId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
index a6987a5..6c133a3 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java
@@ -21,19 +21,19 @@ package com.cloud.agent.api;
 
 public class DeleteBcfSegmentCommand extends BcfCommand {
 
-    private String _tenantUuid;
-    private String _networkUuid;
+    private final String _tenantUuid;
+    private final String _networkUuid;
 
-    public DeleteBcfSegmentCommand(String tenantUuid, String networkUuid) {
+    public DeleteBcfSegmentCommand(final String tenantUuid, final String networkUuid) {
         this._tenantUuid = tenantUuid;
         this._networkUuid = networkUuid;
     }
 
-    public String get_tenantUuid() {
+    public String getTenantUuid() {
         return _tenantUuid;
     }
 
     public String getNetworkUuid() {
         return _networkUuid;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
index 7861bfb..e476565 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java
@@ -24,21 +24,21 @@ public class DeleteBcfStaticNatCommand extends BcfCommand {
     private final String _publicIp;
     private final String _floatingIpId;
 
-    public DeleteBcfStaticNatCommand(String tenantId, String publicIp){
+    public DeleteBcfStaticNatCommand(final String tenantId, final String publicIp){
         this._tenantId = tenantId;
         this._publicIp = publicIp;
         this._floatingIpId = publicIp.replace(".", "-");
     }
 
-    public String get_tenantId() {
+    public String getTenantId() {
         return _tenantId;
     }
 
-    public String get_publicIp() {
+    public String getPublicIp() {
         return _publicIp;
     }
 
-    public String get_floatingIpId() {
+    public String getFloatingIpId() {
         return _floatingIpId;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
index e32bfb0..9f200d8 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java
@@ -20,26 +20,27 @@
 package com.cloud.agent.api;
 
 public class GetControllerDataAnswer extends Answer {
-    private final String ipAddress;
-    private final boolean isMaster;
+    private final String _ipAddress;
+    private final boolean _isMaster;
 
-    public GetControllerDataAnswer(GetControllerDataCommand cmd,
-            String ipAddress, boolean isMaster){
-        this.ipAddress = ipAddress;
-        this.isMaster = isMaster;
+    public GetControllerDataAnswer(final GetControllerDataCommand cmd,
+            final String ipAddress, final boolean isMaster){
+        super(cmd);
+        this._ipAddress = ipAddress;
+        this._isMaster = isMaster;
     }
 
-    public GetControllerDataAnswer(Command command, Exception e) {
+    public GetControllerDataAnswer(final Command command, final Exception e) {
         super(command, e);
-        this.ipAddress = null;
-        this.isMaster = false;
+        this._ipAddress = null;
+        this._isMaster = false;
     }
 
     public String getIpAddress() {
-        return ipAddress;
+        return _ipAddress;
     }
 
     public boolean isMaster() {
-        return isMaster;
+        return _isMaster;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
index 661ad16..96ad119 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java
@@ -20,6 +20,4 @@
 package com.cloud.agent.api;
 
 public class GetControllerDataCommand extends BcfCommand {
-    public GetControllerDataCommand() {
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
index 413e83e..e4c889c 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java
@@ -28,13 +28,13 @@ public class GetControllerHostsAnswer {
     public HostVO getMaster() {
         return master;
     }
-    public void setMaster(HostVO master) {
+    public void setMaster(final HostVO master) {
         this.master = master;
     }
     public HostVO getSlave() {
         return slave;
     }
-    public void setSlave(HostVO slave) {
+    public void setSlave(final HostVO slave) {
         this.slave = slave;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
index 253c8e2..c984b28 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java
@@ -20,6 +20,4 @@
 package com.cloud.agent.api;
 
 public class GetControllerHostsCommand extends BcfCommand {
-    public GetControllerHostsCommand() {
-    }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
index 660151c..89c3e1c 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java
@@ -20,19 +20,19 @@
 package com.cloud.agent.api;
 
 public class SyncBcfTopologyCommand extends BcfCommand {
-    private final boolean networkIncluded;
-    private final boolean routerIncluded;
+    private final boolean _networkIncluded;
+    private final boolean _routerIncluded;
 
-    public SyncBcfTopologyCommand(boolean networkIncluded, boolean routerIncluded) {
-        this.networkIncluded = networkIncluded;
-        this.routerIncluded = routerIncluded;
+    public SyncBcfTopologyCommand(final boolean networkIncluded, final boolean routerIncluded) {
+        this._networkIncluded = networkIncluded;
+        this._routerIncluded = routerIncluded;
     }
 
     public boolean isNetworkIncluded() {
-        return networkIncluded;
+        return _networkIncluded;
     }
 
     public boolean isRouterIncluded() {
-        return routerIncluded;
+        return _routerIncluded;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
index 412ee21..4e054f0 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java
@@ -20,12 +20,13 @@
 package com.cloud.agent.api;
 
 public class UpdateBcfAttachmentCommand extends BcfCommand {
-    private String _networkId;
-    private String _attachmentId;
-    private String _tenantId;
-    private String _attachmentName;
+    private final String _networkId;
+    private final String _attachmentId;
+    private final String _tenantId;
+    private final String _attachmentName;
 
-    public UpdateBcfAttachmentCommand(String networkId, String attachmentId, String tenantId, String attachmentName) {
+    public UpdateBcfAttachmentCommand(final String networkId, final String attachmentId,
+            final String tenantId, final String attachmentName) {
         this._networkId = networkId;
         this._attachmentId = attachmentId;
         this._tenantId = tenantId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
index 675a1ee..47a9356 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java
@@ -27,9 +27,9 @@ import com.cloud.network.bigswitch.AclData;
 public class UpdateBcfRouterCommand extends BcfCommand {
     private String tenantId;
     private String publicIp;
-    private List<AclData> acls;
+    private final List<AclData> acls;
 
-    public UpdateBcfRouterCommand(String tenantId){
+    public UpdateBcfRouterCommand(final String tenantId){
         this.tenantId = tenantId;
         this.publicIp = null;
         this.acls = new ArrayList<AclData>();
@@ -39,7 +39,7 @@ public class UpdateBcfRouterCommand extends BcfCommand {
         return tenantId;
     }
 
-    public void setTenantId(String tenantId) {
+    public void setTenantId(final String tenantId) {
         this.tenantId = tenantId;
     }
 
@@ -47,7 +47,7 @@ public class UpdateBcfRouterCommand extends BcfCommand {
         return publicIp;
     }
 
-    public void setPublicIp(String publicIp) {
+    public void setPublicIp(final String publicIp) {
         this.publicIp = publicIp;
     }
 
@@ -55,7 +55,7 @@ public class UpdateBcfRouterCommand extends BcfCommand {
         return acls;
     }
 
-    public void addAcl(AclData acl){
+    public void addAcl(final AclData acl){
         this.acls.add(acl);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
index 24334ea..8231484 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java
@@ -43,9 +43,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
 @APICommand(name = "addBigSwitchBcfDevice", responseObject = BigSwitchBcfDeviceResponse.class, description = "Adds a BigSwitch BCF Controller device", since = "4.6.0",
         requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
 public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
-    private static final String s_name = "addbigswitchbcfdeviceresponse";
+    private static final String S_NAME = "addbigswitchbcfdeviceresponse";
     @Inject
-    BigSwitchBcfElementService _bigswitchBcfElementService;
+    private BigSwitchBcfElementService bcfElementService;
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
@@ -105,25 +105,24 @@ public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
         ResourceAllocationException {
         try {
-            BigSwitchBcfDeviceVO bigswitchBcfDeviceVO = _bigswitchBcfElementService.addBigSwitchBcfDevice(this);
-            if (bigswitchBcfDeviceVO != null) {
-                BigSwitchBcfDeviceResponse response = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchBcfDeviceVO);
-                response.setObjectName("bigswitchbcfdevice");
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
+            final BigSwitchBcfDeviceVO bigswitchBcfDeviceVO = bcfElementService.addBigSwitchBcfDevice(this);
+            if (bigswitchBcfDeviceVO == null) {
                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add BigSwitch BCF Controller device due to internal error.");
             }
+            final BigSwitchBcfDeviceResponse response = bcfElementService.createBigSwitchBcfDeviceResponse(bigswitchBcfDeviceVO);
+            response.setObjectName("bigswitchbcfdevice");
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
         } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp);
         } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp);
         }
     }
 
     @Override
     public String getCommandName() {
-        return s_name;
+        return S_NAME;
     }
 
     @Override
@@ -133,7 +132,7 @@ public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
 
     @Override
     public String getEventType() {
-        return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_ADD;
+        return BcfConstants.EVENT_BCF_CONTROLLER_ADD;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
index 4b6cc3a..157d9a3 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java
@@ -27,11 +27,11 @@ public class BcfConstants {
     public static final String BIGSWITCH_BCF_DEVICE_ID = "bcfdeviceid";
     public static final String BIGSWITCH_BCF_DEVICE_NAME = "bigswitchdevicename";
     public static final String BIGSWITCH_BCF_DEVICE_NAT = "nat";
-    public static final String EVENT_EXTERNAL_BCF_CONTROLLER_ADD = "PHYSICAL.BCFCONTROLLER.ADD";
-    public static final String EVENT_EXTERNAL_BCF_CONTROLLER_DELETE = "PHYSICAL.BCFCONTROLLER.DELETE";
+    public static final String EVENT_BCF_CONTROLLER_ADD = "PHYSICAL.BCFCONTROLLER.ADD";
+    public static final String EVENT_BCF_CONTROLLER_DELETE = "PHYSICAL.BCFCONTROLLER.DELETE";
 
-    public static final Provider BigSwitchBcf = new Provider("BigSwitchBcf", true);
+    public static final Provider BIG_SWITCH_BCF = new Provider("BigSwitchBcf", true);
 
-    public static final NetworkDevice BigSwitchBcfDevice = new NetworkDevice("BigSwitchBcf", BigSwitchBcf.getName());
+    public static final NetworkDevice BIG_SWITCH_BCF_DEVICE = new NetworkDevice("BigSwitchBcf", BIG_SWITCH_BCF.getName());
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
index 520be8d..f558562 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java
@@ -41,9 +41,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
 @APICommand(name = "deleteBigSwitchBcfDevice", responseObject = SuccessResponse.class, description = " delete a BigSwitch BCF Controller device", since = "4.6.0",
         requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
 public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
-    private static final String s_name = "deletebigswitchbcfdeviceresponse";
+    private static final String S_NAME = "deletebigswitchbcfdeviceresponse";
     @Inject
-    BigSwitchBcfElementService _bigswitchBcfElementService;
+    private BigSwitchBcfElementService bigswitchBcfElementService;
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
@@ -72,24 +72,24 @@ public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
         ResourceAllocationException {
         try {
-            boolean result = _bigswitchBcfElementService.deleteBigSwitchBcfDevice(this);
+            final boolean result = bigswitchBcfElementService.deleteBigSwitchBcfDevice(this);
             if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
+                final SuccessResponse response = new SuccessResponse(getCommandName());
                 response.setResponseName(getCommandName());
                 this.setResponseObject(response);
             } else {
                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete BigSwitch device.");
             }
         } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp);
         } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp);
         }
     }
 
     @Override
     public String getCommandName() {
-        return s_name;
+        return S_NAME;
     }
 
     @Override
@@ -99,7 +99,7 @@ public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd {
 
     @Override
     public String getEventType() {
-        return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_DELETE;
+        return BcfConstants.EVENT_BCF_CONTROLLER_DELETE;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
index 25c6752..3e25848 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java
@@ -48,10 +48,10 @@ import com.cloud.utils.exception.CloudRuntimeException;
 @APICommand(name = "listBigSwitchBcfDevices", responseObject = BigSwitchBcfDeviceResponse.class, description = "Lists BigSwitch BCF Controller devices", since = "4.6.0",
         requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
 public class ListBigSwitchBcfDevicesCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListBigSwitchBcfDevicesCmd.class.getName());
-    private static final String s_name = "listbigswitchbcfdeviceresponse";
+    public static final Logger S_LOGGER = Logger.getLogger(ListBigSwitchBcfDevicesCmd.class.getName());
+    private static final String S_NAME = "listbigswitchbcfdeviceresponse";
     @Inject
-    BigSwitchBcfElementService _bigswitchBcfElementService;
+    private BigSwitchBcfElementService bigswitchBcfElementService;
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
@@ -86,13 +86,13 @@ public class ListBigSwitchBcfDevicesCmd extends BaseListCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
         ResourceAllocationException {
         try {
-            List<BigSwitchBcfDeviceVO> bigswitchDevices = _bigswitchBcfElementService.listBigSwitchBcfDevices(this);
-            ListResponse<BigSwitchBcfDeviceResponse> response = new ListResponse<BigSwitchBcfDeviceResponse>();
-            List<BigSwitchBcfDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchBcfDeviceResponse>();
+            final List<BigSwitchBcfDeviceVO> bigswitchDevices = bigswitchBcfElementService.listBigSwitchBcfDevices(this);
+            final ListResponse<BigSwitchBcfDeviceResponse> response = new ListResponse<BigSwitchBcfDeviceResponse>();
+            final List<BigSwitchBcfDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchBcfDeviceResponse>();
 
             if (bigswitchDevices != null && !bigswitchDevices.isEmpty()) {
-                for (BigSwitchBcfDeviceVO bigswitchDeviceVO : bigswitchDevices) {
-                    BigSwitchBcfDeviceResponse bigswitchDeviceResponse = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchDeviceVO);
+                for (final BigSwitchBcfDeviceVO bigswitchDeviceVO : bigswitchDevices) {
+                    final BigSwitchBcfDeviceResponse bigswitchDeviceResponse = bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchDeviceVO);
                     bigswitchDevicesResponse.add(bigswitchDeviceResponse);
                 }
             }
@@ -101,14 +101,14 @@ public class ListBigSwitchBcfDevicesCmd extends BaseListCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } catch (InvalidParameterValueException invalidParamExcp) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp);
         } catch (CloudRuntimeException runtimeExcp) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp);
         }
     }
 
     @Override
     public String getCommandName() {
-        return s_name;
+        return S_NAME;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
index 37906a5..1d1fe44 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java
@@ -65,35 +65,35 @@ public class BigSwitchBcfDeviceResponse extends BaseResponse {
         return this.id;
     }
 
-    public void setId(String bcfDeviceId) {
+    public void setId(final String bcfDeviceId) {
         this.id = bcfDeviceId;
     }
 
-    public void setPhysicalNetworkId(String physicalNetworkId) {
+    public void setPhysicalNetworkId(final String physicalNetworkId) {
         this.physicalNetworkId = physicalNetworkId;
     }
 
-    public void setProviderName(String providerName) {
+    public void setProviderName(final String providerName) {
         this.providerName = providerName;
     }
 
-    public void setDeviceName(String deviceName) {
+    public void setDeviceName(final String deviceName) {
         this.deviceName = deviceName;
     }
 
-    public void setHostName(String hostName) {
+    public void setHostName(final String hostName) {
         this.hostName = hostName;
     }
 
-    public void setUserName(String username) {
+    public void setUserName(final String username) {
         this.username = username;
     }
 
-    public void setPassword(String password) {
+    public void setPassword(final String password) {
         this.password = password;
     }
 
-    public void setNat(Boolean nat) {
+    public void setNat(final Boolean nat) {
         this.nat = nat;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
index 8c7269e..1338eeb 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java
@@ -73,8 +73,10 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity {
         this.uuid = UUID.randomUUID().toString();
     }
 
-    public BigSwitchBcfDeviceVO(long hostId, long physicalNetworkId, String providerName, String deviceName,
-            String hostName, String username, String password, Boolean nat, String hash) {
+    public BigSwitchBcfDeviceVO(final long hostId, final long physicalNetworkId,
+            final String providerName, final String deviceName,final String hostName,
+            final String username, final String password, final Boolean nat,
+            final String hash) {
         super();
         this.hostId = hostId;
         this.physicalNetworkId = physicalNetworkId;
@@ -97,7 +99,7 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity {
         return uuid;
     }
 
-    public void setUuid(String uuid) {
+    public void setUuid(final String uuid) {
         this.uuid = uuid;
     }
 
@@ -121,7 +123,7 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity {
         return hash;
     }
 
-    public void setHash(String h) {
+    public void setHash(final String h) {
         hash = h;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
index 72b0cc9..150bc61 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java
@@ -19,6 +19,8 @@
 
 package com.cloud.network.bigswitch;
 
+import java.util.Locale;
+
 import com.cloud.network.vpc.NetworkACLItem;
 import com.google.gson.annotations.SerializedName;
 
@@ -41,19 +43,19 @@ public class AclData {
         this.action = null;
         this.ipProto = null;
         this.source = new AclNetwork();
-        this.destination = new AclNetwork();;
+        this.destination = new AclNetwork();
     }
 
     public class AclNetwork{
-        @SerializedName("cidr") private String cidr;
-        @SerializedName("port") private Integer port;
+        @SerializedName("cidr") final private String cidr;
+        @SerializedName("port") final private Integer port;
 
         public AclNetwork(){
             this.cidr = null;
             this.port = null;
         }
 
-        public AclNetwork(String cidr, Integer port){
+        public AclNetwork(final String cidr, final Integer port){
             this.cidr = cidr;
             this.port = port;
         }
@@ -62,19 +64,19 @@ public class AclData {
     public String getId() {
         return id;
     }
-    public void setId(String id) {
+    public void setId(final String id) {
         this.id = id;
     }
     public int getPriority() {
         return priority;
     }
-    public void setPriority(int priority) {
+    public void setPriority(final int priority) {
         this.priority = priority;
     }
     public String getAction() {
         return action;
     }
-    public void setAction(String action) {
+    public void setAction(final String action) {
         if(action.equalsIgnoreCase(NetworkACLItem.Action.Allow.name())){
             this.action = "permit";
         } else {
@@ -84,9 +86,9 @@ public class AclData {
     public String getIpProto() {
         return ipProto;
     }
-    public void setIpProto(String ipProto) {
-        if (!ipProto.equalsIgnoreCase("all")){
-            switch(ipProto.toLowerCase()){
+    public void setIpProto(final String ipProto) {
+        if (ipProto != null && !ipProto.equalsIgnoreCase("all")){
+            switch(ipProto.toLowerCase(Locale.ENGLISH)){
             case "tcp":
                 this.ipProto = "6";
                 break;
@@ -96,19 +98,21 @@ public class AclData {
             case "icmp":
                 this.ipProto = "1";
                 break;
+            default:
+                throw new IllegalArgumentException("Protocol in ACL rule not supported");
             }
         }
     }
     public AclNetwork getSource() {
         return source;
     }
-    public void setSource(AclNetwork source) {
+    public void setSource(final AclNetwork source) {
         this.source = source;
     }
     public AclNetwork getDestination() {
         return destination;
     }
-    public void setDestination(AclNetwork destination) {
+    public void setDestination(final AclNetwork destination) {
         this.destination = destination;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
index 649f704..40d99e3 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java
@@ -20,6 +20,7 @@
 package com.cloud.network.bigswitch;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import com.google.gson.annotations.SerializedName;
 
@@ -28,7 +29,7 @@ import com.google.gson.annotations.SerializedName;
  * in CreateBcfAttachmentCommand
  */
 public class AttachmentData {
-    @SerializedName("port") private Attachment attachment;
+    @SerializedName("port") final private Attachment attachment;
 
     public Attachment getAttachment() {
         return this.attachment;
@@ -42,9 +43,9 @@ public class AttachmentData {
         @SerializedName("id") private String id;
         @SerializedName("tenant_name") private String tenantName;
         @SerializedName("vlan") private Integer vlan;
-        @SerializedName("fixed_ips") private ArrayList<IpAddress> fixedIps;
+        @SerializedName("fixed_ips") final private List<IpAddress> fixedIps;
         @SerializedName("mac_address") private String macAddress;
-        @SerializedName("bound_segment") private BoundSegment boundSegment;
+        @SerializedName("bound_segment") final private BoundSegment boundSegment;
         @SerializedName("binding:host_id") private String hostId;
 
         public Attachment(){
@@ -65,14 +66,14 @@ public class AttachmentData {
         }
 
         public class IpAddress {
-            @SerializedName("ip_address") private String ipAddress;
+            @SerializedName("ip_address") private String address;
 
-            public IpAddress(String ipAddr) {
-                this.ipAddress = ipAddr;
+            public IpAddress(final String ipAddr) {
+                this.address = ipAddr;
             }
 
             public String getIpAddress(){
-                return ipAddress;
+                return address;
             }
         }
 
@@ -82,7 +83,7 @@ public class AttachmentData {
             return tenantName;
         }
 
-        public void setTenantName(String tenantName) {
+        public void setTenantName(final String tenantName) {
             this.tenantName = tenantName;
         }
 
@@ -90,7 +91,7 @@ public class AttachmentData {
             return id;
         }
 
-        public void setId(String id) {
+        public void setId(final String id) {
             this.id = id;
         }
 
@@ -98,7 +99,7 @@ public class AttachmentData {
             return hostId;
         }
 
-        public void setHostId(String hostId) {
+        public void setHostId(final String hostId) {
             this.hostId = hostId;
         }
 
@@ -106,16 +107,16 @@ public class AttachmentData {
             return vlan;
         }
 
-        public void setVlan(Integer vlan) {
+        public void setVlan(final Integer vlan) {
             this.vlan = vlan;
             this.boundSegment.setSegmentationId(vlan);
         }
 
-        public ArrayList<IpAddress> getIpv4List() {
+        public List<IpAddress> getIpv4List() {
             return fixedIps;
         }
 
-        public void addIpv4(String ipv4) {
+        public void addIpv4(final String ipv4) {
             this.fixedIps.add(new IpAddress(ipv4));
         }
 
@@ -123,7 +124,7 @@ public class AttachmentData {
             return macAddress;
         }
 
-        public void setMac(String mac) {
+        public void setMac(final String mac) {
             this.macAddress = mac;
         }
 
@@ -135,7 +136,7 @@ public class AttachmentData {
             return state;
         }
 
-        public void setState(String state) {
+        public void setState(final String state) {
             this.state = state;
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
index 5c1efb0..16cb3f7 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
@@ -53,25 +53,25 @@ import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
 public class BigSwitchBcfApi {
-    private static final Logger s_logger = Logger.getLogger(BigSwitchBcfApi.class);
-    private final static String s_protocol = "https";
-    private final static String s_nsBaseUri = "/networkService/v1.1";
+    private static final Logger S_LOGGER = Logger.getLogger(BigSwitchBcfApi.class);
+    private final static String S_PROTOCOL = "https";
+    private final static String S_NS_BASE_URL = "/networkService/v1.1";
     private final static String CONTENT_TYPE = "Content-type";
     private final static String ACCEPT = "Accept";
     private final static String CONTENT_JSON = "application/json";
     private final static String HTTP_HEADER_INSTANCE_ID = "Instance-ID";
     private final static String CLOUDSTACK_INSTANCE_ID = "cloudstack";
     private final static String HASH_MATCH = "X-BSN-BVS-HASH-MATCH";
-    private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
+    private final static MultiThreadedHttpConnectionManager S_HTTP_CLIENT_MANAGER = new MultiThreadedHttpConnectionManager();
 
-    private String _host;
-    private String _username;
-    private String _password;
-    private String _hash;
-    private String _zoneId;
-    private Boolean _nat;
+    private String host;
+    private String username;
+    private String password;
+    private String hash;
+    private String zoneId;
+    private Boolean nat;
 
-    private boolean _isMaster = false;
+    private boolean isMaster;
 
     private int _port = 8000;
 
@@ -85,15 +85,15 @@ public class BigSwitchBcfApi {
      * in the unittests.
      */
     protected HttpClient createHttpClient() {
-        return new HttpClient(s_httpClientManager);
+        return new HttpClient(S_HTTP_CLIENT_MANAGER);
     }
 
-    protected HttpMethod createMethod(String type, String uri, int port) throws BigSwitchBcfApiException {
+    protected HttpMethod createMethod(final String type, final String uri, final int port) throws BigSwitchBcfApiException {
         String url;
         try {
-            url = new URL(s_protocol, _host, port, uri).toString();
+            url = new URL(S_PROTOCOL, host, port, uri).toString();
         } catch (MalformedURLException e) {
-            s_logger.error("Unable to build Big Switch API URL", e);
+            S_LOGGER.error("Unable to build Big Switch API URL", e);
             throw new BigSwitchBcfApiException("Unable to build Big Switch API URL", e);
         }
 
@@ -118,7 +118,7 @@ public class BigSwitchBcfApi {
             // Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter
             Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), _port));
         } catch (IOException e) {
-            s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e);
+            S_LOGGER.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e);
         }
     }
 
@@ -126,99 +126,99 @@ public class BigSwitchBcfApi {
      * Setter used by UI to set BSN controller address
      * @param address
      */
-    public void setControllerAddress(String address) {
-        this._host = address;
+    public void setControllerAddress(final String address) {
+        this.host = address;
     }
 
     /**
      * Setter used by UI to set BSN controller user name
      * @param username
      */
-    public void setControllerUsername(String username) {
-        this._username = username;
+    public void setControllerUsername(final String username) {
+        this.username = username;
     }
 
     /**
      * Setter used by UI to set BSN controller password
      * @param password
      */
-    public void setControllerPassword(String password) {
-        this._password = password;
+    public void setControllerPassword(final String password) {
+        this.password = password;
     }
 
     /**
      * Setter used by UI to set BSN controller NAT mode
      * @param nat
      */
-    public void setControllerNat(Boolean nat) {
-        this._nat = nat;
+    public void setControllerNat(final Boolean nat) {
+        this.nat = nat;
     }
 
     public boolean isNatEnabled() {
-        return this._nat;
+        return this.nat;
     }
 
-    /**
-     * Setter used by UI to set BSN controller password
-     * @param password
-     */
-    public void setZoneId(String zoneId) {
-        this._zoneId = zoneId;
+    public void setZoneId(final String zoneId) {
+        this.zoneId = zoneId;
     }
 
-    public String createNetwork(NetworkData network) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + network.getNetwork().getTenantId() + "/networks";
+    public String createNetwork(final NetworkData network) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + network.getNetwork().getTenantId() + "/networks";
         return executeCreateObject(network, uri, Collections.<String, String> emptyMap());
     }
 
-    public String deleteNetwork(String tenantId, String networkId) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId;
+    public String deleteNetwork(final String tenantId, final String networkId) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId;
         return executeDeleteObject(uri);
     }
 
-    public String createAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
+    public String createAttachment(final String tenantId, final String networkId,
+            final AttachmentData attachment) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
         return executeCreateObject(attachment, uri, Collections.<String, String> emptyMap());
     }
 
-    public String modifyAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
+    public String modifyAttachment(final String tenantId, final String networkId,
+            final AttachmentData attachment) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment";
         return executeUpdateObject(attachment, uri, Collections.<String, String> emptyMap());
     }
 
-    public String deleteAttachment(String tenantId, String networkId, String attachmentId) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachmentId + "/attachment";
+    public String deleteAttachment(final String tenantId, final String networkId,
+            final String attachmentId) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachmentId + "/attachment";
         return executeDeleteObject(uri);
     }
 
-    public String createRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers";
+    public String createRouter(final String tenantId, final RouterData router) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers";
         return executeCreateObject(router, uri, Collections.<String, String> emptyMap());
     }
 
-    public String modifyRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException,
+    public String modifyRouter(final String tenantId, final RouterData router) throws BigSwitchBcfApiException,
     IllegalArgumentException{
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers";
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers";
         return executeCreateObject(router, uri, Collections.<String, String> emptyMap());
     }
 
-    public String createRouterInterface(String tenantId, String routerId, RouterInterfaceData routerInterface) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers/" + routerId + "/interfaces";
+    public String createRouterInterface(final String tenantId, final String routerId,
+            final RouterInterfaceData routerInterface) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers/" + routerId + "/interfaces";
         return executeCreateObject(routerInterface, uri, Collections.<String, String> emptyMap());
     }
 
-    public String createFloatingIp(String tenantId, FloatingIpData fip) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips";
+    public String createFloatingIp(final String tenantId, final FloatingIpData fip) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/floatingips";
         return executeCreateObject(fip, uri, Collections.<String, String> emptyMap());
     }
 
-    public String deleteFloatingIp(String tenantId, String fipId) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips/" + fipId;
+    public String deleteFloatingIp(final String tenantId, final String fipId) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/floatingips/" + fipId;
         return executeDeleteObject(uri);
     }
 
     public ControlClusterStatus getControlClusterStatus() throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/health";
+        String uri = S_NS_BASE_URL + "/health";
         ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>() {
         }.getType(), uri, null);
         ccs.setStatus(true);
@@ -226,7 +226,7 @@ public class BigSwitchBcfApi {
     }
 
     public Capabilities getCapabilities() throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/capabilities";
+        String uri = S_NS_BASE_URL + "/capabilities";
         List<String> capslist = executeRetrieveObject(new TypeToken<List<String>>() {
         }.getType(), uri, null);
         Capabilities caps = new Capabilities();
@@ -234,28 +234,28 @@ public class BigSwitchBcfApi {
         return caps;
     }
 
-    public String syncTopology(TopologyData topo) throws BigSwitchBcfApiException {
-        String uri = s_nsBaseUri + "/topology";
+    public String syncTopology(final TopologyData topo) throws BigSwitchBcfApiException {
+        String uri = S_NS_BASE_URL + "/topology";
         return executeCreateObject(topo, uri, Collections.<String, String> emptyMap());
     }
 
     public ControllerData getControllerData() {
-        return new ControllerData(_host, _isMaster);
+        return new ControllerData(host, isMaster);
     }
 
     private void checkInvariants() throws BigSwitchBcfApiException{
-        if (_host == null || _host.isEmpty()) {
+        if (host == null || host.isEmpty()) {
             throw new BigSwitchBcfApiException("Hostname is null or empty");
         }
-        if (_username == null || _username.isEmpty()){
+        if (username == null || username.isEmpty()){
             throw new BigSwitchBcfApiException("Username is null or empty");
         }
-        if (_password == null || _password.isEmpty()){
+        if (password == null || password.isEmpty()){
             throw new BigSwitchBcfApiException("Password is null or empty");
         }
     }
 
-    private String checkResponse(HttpMethodBase m, String errorMessageBase) throws BigSwitchBcfApiException,
+    private String checkResponse(final HttpMethodBase m, final String errorMessageBase) throws BigSwitchBcfApiException,
     IllegalArgumentException{
         String customErrorMsg = null;
         if (m.getStatusCode() == HttpStatus.SC_OK) {
@@ -273,7 +273,7 @@ public class BigSwitchBcfApi {
             throw new BigSwitchBcfApiException("BCF topology sync required", true);
         }
         if (m.getStatusCode() == HttpStatus.SC_SEE_OTHER) {
-            _isMaster = false;
+            isMaster = false;
             set_hash(HASH_IGNORE);
             return HASH_IGNORE;
         }
@@ -288,24 +288,25 @@ public class BigSwitchBcfApi {
         }
         String errorMessage = responseToErrorMessage(m);
         m.releaseConnection();
-        s_logger.error(errorMessageBase + errorMessage);
+        S_LOGGER.error(errorMessageBase + errorMessage);
         throw new BigSwitchBcfApiException(errorMessageBase + errorMessage + customErrorMsg);
     }
 
-    private void setHttpHeader(HttpMethodBase m) {
+    private void setHttpHeader(final HttpMethodBase m) {
         m.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
         m.setRequestHeader(ACCEPT, CONTENT_JSON);
-        m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + _zoneId);
-        if (_hash != "" ) {
-            m.setRequestHeader(HASH_MATCH, _hash);
+        m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + zoneId);
+        if (hash != "" ) {
+            m.setRequestHeader(HASH_MATCH, hash);
         }
 
-        String authString = _username + ":" + _password;
+        String authString = username + ":" + password;
         String encodedAuthString = "Basic " + Base64.encodeBase64String(authString.getBytes(Charset.forName("UTF-8")));
         m.setRequestHeader("Authorization", encodedAuthString);
     }
 
-    protected <T> String executeUpdateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException,
+    protected <T> String executeUpdateObject(final T newObject, final String uri,
+            final Map<String, String> parameters) throws BigSwitchBcfApiException,
     IllegalArgumentException{
         checkInvariants();
 
@@ -328,7 +329,8 @@ public class BigSwitchBcfApi {
         return hash;
     }
 
-    protected <T> String executeCreateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException {
+    protected <T> String executeCreateObject(final T newObject, final String uri,
+            final Map<String, String> parameters) throws BigSwitchBcfApiException {
         checkInvariants();
 
         PostMethod pm = (PostMethod)createMethod("post", uri, _port);
@@ -350,7 +352,7 @@ public class BigSwitchBcfApi {
         return hash;
     }
 
-    protected String executeDeleteObject(String uri) throws BigSwitchBcfApiException {
+    protected String executeDeleteObject(final String uri) throws BigSwitchBcfApiException {
         checkInvariants();
 
         DeleteMethod dm = (DeleteMethod)createMethod("delete", uri, _port);
@@ -367,8 +369,8 @@ public class BigSwitchBcfApi {
     }
 
     @SuppressWarnings("unchecked")
-    protected <T> T executeRetrieveObject(Type returnObjectType,
-            String uri, Map<String, String> parameters) throws BigSwitchBcfApiException {
+    protected <T> T executeRetrieveObject(final Type returnObjectType,
+            final String uri, final Map<String, String> parameters) throws BigSwitchBcfApiException {
         checkInvariants();
 
         GetMethod gm = (GetMethod)createMethod("get", uri, _port);
@@ -392,41 +394,41 @@ public class BigSwitchBcfApi {
             // CAUTIOUS: Safety margin of 2048 characters - extend if needed.
             returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(2048), returnObjectType);
         } catch (IOException e) {
-            s_logger.error("IOException while retrieving response body", e);
+            S_LOGGER.error("IOException while retrieving response body", e);
             throw new BigSwitchBcfApiException(e);
         } finally {
             gm.releaseConnection();
         }
         if(returnValue instanceof ControlClusterStatus) {
             if(hash == HASH_CONFLICT) {
-                _isMaster = true;
+                isMaster = true;
                 ((ControlClusterStatus) returnValue).setTopologySyncRequested(true);
-            } else if (hash != HASH_IGNORE && !_isMaster) {
-                _isMaster = true;
+            } else if (hash != HASH_IGNORE && !isMaster) {
+                isMaster = true;
                 ((ControlClusterStatus) returnValue).setTopologySyncRequested(true);
             }
         }
         return returnValue;
     }
 
-    protected void executeMethod(HttpMethodBase method) throws BigSwitchBcfApiException {
+    protected void executeMethod(final HttpMethodBase method) throws BigSwitchBcfApiException {
         try {
             _client.executeMethod(method);
             if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                 method.releaseConnection();
             }
         } catch (HttpException e) {
-            s_logger.error("HttpException caught while trying to connect to the BigSwitch Controller", e);
+            S_LOGGER.error("HttpException caught while trying to connect to the BigSwitch Controller", e);
             method.releaseConnection();
             throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e);
         } catch (IOException e) {
-            s_logger.error("IOException caught while trying to connect to the BigSwitch Controller", e);
+            S_LOGGER.error("IOException caught while trying to connect to the BigSwitch Controller", e);
             method.releaseConnection();
             throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e);
         }
     }
 
-    private String responseToErrorMessage(HttpMethodBase method) {
+    private String responseToErrorMessage(final HttpMethodBase method) {
         assert method.isRequestSent() : "no use getting an error message unless the request is sent";
 
         if ("text/html".equals(method.getResponseHeader(CONTENT_TYPE).getValue())) {
@@ -436,7 +438,7 @@ public class BigSwitchBcfApi {
             try {
                 return method.getResponseBodyAsString(2048);
             } catch (IOException e) {
-                s_logger.debug("Error while loading response body", e);
+                S_LOGGER.debug("Error while loading response body", e);
             }
         }
 
@@ -449,11 +451,11 @@ public class BigSwitchBcfApi {
     }
 
     public String get_hash() {
-        return _hash;
+        return hash;
     }
 
-    public void set_hash(String hash) {
-        this._hash = hash;
+    public void set_hash(final String hash) {
+        this.hash = hash;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
index 242089f..61f3d48 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java
@@ -177,7 +177,7 @@ public class BigSwitchBcfUtils {
 
         // handle external network first, only if NAT service is enabled
         if(networks != null) {
-            if (!(networks.isEmpty()) && isNatEnabled()) {
+            if(!(networks.isEmpty()) && isNatEnabled()){
                 // get public net info - needed to set up source nat gateway
                 NetworkVO pubNet = getPublicNetwork(physicalNetworkId);
 
@@ -380,7 +380,7 @@ public class BigSwitchBcfUtils {
             Integer port = rule.getSourcePortStart();
             fwCidrList = _fwCidrsDao.listByFirewallRuleId(rule.getId());
             if(fwCidrList != null){
-                if (fwCidrList.size() > 1 || !rule.getSourcePortEnd().equals(port)) {
+                if(fwCidrList.size()>1 || !rule.getSourcePortEnd().equals(port)){
                     continue;
                 } else {
                     cidr = fwCidrList.get(0).getCidr();
@@ -414,7 +414,7 @@ public class BigSwitchBcfUtils {
                 Integer port = item.getSourcePortStart(); // currently BCF supports single port policy
                 aclCidrList = _aclItemCidrsDao.listByNetworkACLItemId(item.getId());
                 if(aclCidrList != null){
-                    if (aclCidrList.size() > 1 || !item.getSourcePortEnd().equals(port)) {
+                    if(aclCidrList.size()>1 || !item.getSourcePortEnd().equals(port)){
                         continue;
                     } else {
                         cidr = aclCidrList.get(0).getCidr();
@@ -440,7 +440,7 @@ public class BigSwitchBcfUtils {
 
     public String syncTopologyToBcfHost(HostVO bigswitchBcfHost){
         SyncBcfTopologyCommand syncCmd;
-        if (isNatEnabled()) {
+        if(isNatEnabled()){
             syncCmd = new SyncBcfTopologyCommand(true, true);
         } else {
             syncCmd = new SyncBcfTopologyCommand(true, false);
@@ -486,7 +486,7 @@ public class BigSwitchBcfUtils {
         }
 
         String newHash = answer.getHash();
-        if (cmd.is_topologySyncRequested()) {
+        if (cmd.isTopologySyncRequested()) {
             newHash = syncTopologyToBcfHost(cluster.getMaster());
         }
         if(newHash != null){
@@ -519,7 +519,7 @@ public class BigSwitchBcfUtils {
         });
     }
 
-    public boolean isNatEnabled() {
+    public Boolean isNatEnabled(){
         List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll();
         if(devices != null && !devices.isEmpty()){
             return devices.get(0).getNat();
@@ -528,8 +528,6 @@ public class BigSwitchBcfUtils {
         }
     }
 
-    // returns null: should throw something^%*%#&
-    // Integer -> int
     public Integer getSubnetMaskLength(String maskString){
         if(!IPAddress.isValidIPv4(maskString)){
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
index 1dbf62d..3c69f3b 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java
@@ -30,26 +30,25 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.commons.net.util.SubnetUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+import org.apache.commons.net.util.SubnetUtils;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.BcfAnswer;
+import com.cloud.agent.api.UpdateBcfRouterCommand;
 import com.cloud.agent.api.CreateBcfAttachmentCommand;
 import com.cloud.agent.api.CreateBcfStaticNatCommand;
 import com.cloud.agent.api.DeleteBcfAttachmentCommand;
 import com.cloud.agent.api.DeleteBcfStaticNatCommand;
 import com.cloud.agent.api.StartupBigSwitchBcfCommand;
 import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.UpdateBcfRouterCommand;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd;
-import com.cloud.api.commands.BcfConstants;
 import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd;
 import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd;
+import com.cloud.api.commands.BcfConstants;
 import com.cloud.api.response.BigSwitchBcfDeviceResponse;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.dc.DataCenterVO;
@@ -209,7 +208,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             return false;
         }
 
-        if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, BcfConstants.BigSwitchBcf)) {
+        if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, BcfConstants.BIG_SWITCH_BCF)) {
             s_logger.debug("BigSwitchBcfElement can't provide the " + service.getName() + " service on network " + network.getDisplayText());
             return false;
         }
@@ -411,7 +410,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
 
         ServerResource resource = new BigSwitchBcfResource();
 
-        final String deviceName = BcfConstants.BigSwitchBcf.getName();
+        final String deviceName = BcfConstants.BIG_SWITCH_BCF.getName();
         NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName);
         final Long physicalNetworkId = cmd.getPhysicalNetworkId();
         final String hostname = cmd.getHost();
@@ -452,7 +451,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             zoneName = String.valueOf(zoneId);
         }
 
-        boolean natNow = _bcfUtils.isNatEnabled();
+        Boolean natNow =  _bcfUtils.isNatEnabled();
         if (!nat && natNow){
             throw new CloudRuntimeException("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first.");
         } else if (nat && !natNow){
@@ -684,7 +683,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             }
             cidrList = r.getSourceCidrList();
             if(cidrList != null){
-                if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) {
+                if(cidrList.size()>1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())){
                     throw new ResourceUnavailableException("One CIDR and one port only please.",
                             Network.class, network.getId());
                 } else {
@@ -718,7 +717,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
             }
             cidrList = r.getSourceCidrList();
             if(cidrList != null){
-                if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) {
+                if(cidrList.size()>1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())){
                     throw new ResourceUnavailableException("One CIDR and one port only please.",
                             Network.class, network.getId());
                 } else {


[15/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
findbugs: explicit default encoding

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/015eef2f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/015eef2f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/015eef2f

Branch: refs/heads/reporter
Commit: 015eef2f4beedceb8463696ea84ccb0e4c53b26d
Parents: 559b014
Author: Daan Hoogland <dh...@schubergphilis.com>
Authored: Sun Apr 12 19:39:25 2015 +0200
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Sun Apr 12 19:39:25 2015 +0200

----------------------------------------------------------------------
 core/src/com/cloud/resource/CommandWrapper.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/015eef2f/core/src/com/cloud/resource/CommandWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/resource/CommandWrapper.java b/core/src/com/cloud/resource/CommandWrapper.java
index 15f7b08..48c105f 100644
--- a/core/src/com/cloud/resource/CommandWrapper.java
+++ b/core/src/com/cloud/resource/CommandWrapper.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.Charset;
 
 import org.apache.log4j.Logger;
 
@@ -70,7 +71,7 @@ public abstract class CommandWrapper<T extends Command, A extends Answer, R exte
             conn.setReadTimeout(5000);
 
             final InputStream is = conn.getInputStream();
-            final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+            final BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.defaultCharset()));
             final StringBuilder sb2 = new StringBuilder();
             String line = null;
             try {


[49/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Make the routers persistent

  - After configuration save the ipdated in files
    * /etc/iptables/router_rules.v4 and /etc/iptables/router_rules.v6
    * Reload the configuration on reboot via the /etc/rc.local using iptables-restore


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2fad87d3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2fad87d3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2fad87d3

Branch: refs/heads/reporter
Commit: 2fad87d3f3fec380ba5d595ee95f5caa88b37ee8
Parents: e81161d
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Apr 14 15:03:35 2015 +0200
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Tue Apr 14 15:09:47 2015 +0200

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/rc.local         | 13 +++++++++++++
 .../debian/config/opt/cloud/bin/configure.py        |  6 +++++-
 .../debian/config/opt/cloud/bin/cs/CsHelper.py      | 16 ++++++++++++++--
 3 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/etc/rc.local
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/rc.local b/systemvm/patches/debian/config/etc/rc.local
index 23e913e..18e7cd1 100755
--- a/systemvm/patches/debian/config/etc/rc.local
+++ b/systemvm/patches/debian/config/etc/rc.local
@@ -46,3 +46,16 @@ python /opt/cloud/bin/baremetal-vr.py &
 
 date > /var/cache/cloud/boot_up_done
 logger -t cloud "Boot up process done"
+
+#Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
+ipv4="/etc/iptables/router_rules.v4"
+if [ -e $ipv4 ]
+then
+   iptables-restore < $ipv4
+fi
+
+ipv6="/etc/iptables/router_rules.v6"
+if [ -e $ipv6 ]
+then
+   iptables-restore < $ipv6
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index b03928b..799e279 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -676,6 +676,10 @@ def main(argv):
 
     mon = CsMonitor("monitorservice", config)
     mon.process()
-
+    
+    #Save iptables configuration - will be loaded on reboot by the iptables-restore that is configured on /etc/rc.local
+    CsHelper.save_iptables("iptables-save", "/etc/iptables/router_rules.v4")
+    CsHelper.save_iptables("ip6tables-save", "/etc/iptables/router_rules.v6")
+    
 if __name__ == "__main__":
     main(sys.argv)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
index f01bb8c..708422c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 """ General helper functions
-for use in the configuation process
+for use in the configuration process
 
 """
 import subprocess
@@ -27,7 +27,6 @@ import shutil
 from netaddr import *
 from pprint import pprint
 
-
 def is_mounted(name):
     for i in execute("mount"):
         vals = i.lstrip().split()
@@ -163,6 +162,19 @@ def execute(command):
     return result.splitlines()
 
 
+def save_iptables(command, iptables_file):
+    """ Execute command """
+    logging.debug("Saving iptables for %s" % command)
+    
+    result = execute(command)
+    fIptables = open(iptables_file, "w+")
+    
+    for line in result:
+        fIptables.write(line)
+        fIptables.write("\n")
+    fIptables.close()
+
+
 def execute2(command):
     """ Execute command """
     logging.debug("Executing %s" % command)


[53/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
Proposal of a Usage Reporter / call-home functionality for CloudStack

With this commit the Management Server will be default generate a anonymous Usage
report every 7 (seven) days and submit this information back to the Apache CloudStack project.

These anonymous reports do NOT contain any information about Instance names, subnets, etc. It only
contains numbers about how CloudStack is being used.

This information is vital for the project to gain more insight in how CloudStack is being used.

Users can turn the reporting off by setting usage.report.interval to 0 (zero)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5c997847
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5c997847
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5c997847

Branch: refs/heads/reporter
Commit: 5c9978471e12c9e3059eb9324e6d2658b1f1f211
Parents: 581f3b7
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Thu Nov 20 14:43:33 2014 +0100
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed Apr 15 09:24:56 2015 +0200

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/VersionDao.java   |   4 +
 .../com/cloud/upgrade/dao/VersionDaoImpl.java   |   9 +
 pom.xml                                         |   2 +-
 reporter/README.md                              |  18 +
 reporter/usage-report-collector.py              |  64 +++
 server/pom.xml                                  |  10 +
 .../spring-server-core-managers-context.xml     |   2 +
 server/src/com/cloud/configuration/Config.java  |   5 +-
 .../cloudstack/report/AtomicGsonAdapter.java    |  48 ++
 .../apache/cloudstack/report/UsageReporter.java | 470 +++++++++++++++++++
 setup/db/db/schema-451to460.sql                 |   2 +
 11 files changed, 632 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/engine/schema/src/com/cloud/upgrade/dao/VersionDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/VersionDao.java b/engine/schema/src/com/cloud/upgrade/dao/VersionDao.java
index e280e0b..1a60f36 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/VersionDao.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/VersionDao.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.upgrade.dao;
 
+import java.util.List;
+
 import com.cloud.upgrade.dao.VersionVO.Step;
 import com.cloud.utils.db.GenericDao;
 
@@ -23,4 +25,6 @@ public interface VersionDao extends GenericDao<VersionVO, Long> {
     VersionVO findByVersion(String version, Step step);
 
     String getCurrentVersion();
+
+    List<VersionVO> getAllVersions();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java b/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
index 3be101b..344d8c0 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
@@ -170,4 +170,13 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
         }
 
     }
+
+    @Override
+    @DB
+    public List<VersionVO> getAllVersions() {
+        SearchCriteria<VersionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("step", "Complete");
+
+        return listBy(sc);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 175394c..ee813c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
     <cs.jasypt.version>1.9.2</cs.jasypt.version>
     <cs.trilead.version>1.0.0-build217</cs.trilead.version>
     <cs.ehcache.version>2.6.9</cs.ehcache.version>
-    <cs.gson.version>1.7.2</cs.gson.version>
+    <cs.gson.version>2.3.1</cs.gson.version>
     <cs.guava.version>18.0</cs.guava.version>
     <cs.xapi.version>6.2.0-3.1</cs.xapi.version>
     <cs.httpclient.version>4.3.6</cs.httpclient.version>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/reporter/README.md
----------------------------------------------------------------------
diff --git a/reporter/README.md b/reporter/README.md
new file mode 100644
index 0000000..6453fa4
--- /dev/null
+++ b/reporter/README.md
@@ -0,0 +1,18 @@
+# CloudStack Usage Report
+
+This directory contains the CloudStack reporter webservice used by the Apache CloudStack project
+to gather anonymous statistical information about CloudStack deployments.
+
+Since version <FIX ME!!> the management server sends out a anonymized Usage Report out to the
+project every 7 days.
+
+This information is used to gain information about how CloudStack is being used.
+
+Turning this Usage Reporting functionality off can be done in the Global Settings by setting
+'usage.report.interval' to 0.
+
+# The webservice
+The Python Flask application in this directory is the webservice running on https://reports.cloudstack.apache.org/ (FIX ME?)
+and stores all the incoming information in a ElasticSearch database.
+
+Since Apache CloudStack is Open Source we show not only how we generate the report, but also how we process it.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/reporter/usage-report-collector.py
----------------------------------------------------------------------
diff --git a/reporter/usage-report-collector.py b/reporter/usage-report-collector.py
new file mode 100755
index 0000000..500a4d2
--- /dev/null
+++ b/reporter/usage-report-collector.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from flask import abort, Flask, request, Response
+from elasticsearch import Elasticsearch
+import json
+import time
+
+def json_response(response):
+    return json.dumps(response, indent=2) + "\n", 200, {'Content-Type': 'application/json; charset=utf-8'}
+
+def generate_app(config=None):
+    app = Flask(__name__)
+
+    @app.route('/report/<unique_id>', methods=['POST'])
+    def report(unique_id):
+        # We expect JSON data, so if the Content-Type doesn't match JSON data we throw an error
+        if 'Content-Type' in request.headers:
+            if request.headers['Content-Type'] != 'application/json':
+                abort(417, "No or incorrect Content-Type header was supplied")
+
+        index = "cloudstack-%s" % time.strftime("%Y.%m.%d", time.gmtime())
+        timestamp = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
+
+        es = Elasticsearch()
+        es.indices.create(index=index, ignore=400)
+
+        report = json.loads(request.data)
+        report["unique_id"] = unique_id
+        report["timestamp"] = timestamp
+
+        es.index(index=index, doc_type="usage-report", body=json.dumps(report), timestamp=timestamp, refresh=True)
+
+        response = {}
+        return json_response(response)
+
+    return app
+
+
+app = generate_app()
+
+# Only run the App if this script is invoked from a Shell
+if __name__ == '__main__':
+    app.debug = True
+    app.run(host='0.0.0.0', port=8088)
+
+# Otherwise provide a variable called 'application' for mod_wsgi
+else:
+    application = app

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index c293aa1..f2a2a0e 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -138,6 +138,16 @@
       <artifactId>opensaml</artifactId>
       <version>${cs.opensaml.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>${cs.gson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${cs.guava.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <testResources>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
----------------------------------------------------------------------
diff --git a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
index ad43fa9..aa40338 100644
--- a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
+++ b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
@@ -224,6 +224,8 @@
 
     <bean id="statsCollector" class="com.cloud.server.StatsCollector" />
 
+    <bean id="usageReporter" class="org.apache.cloudstack.report.UsageReporter" />
+
     <bean id="storagePoolAutomationImpl" class="com.cloud.storage.StoragePoolAutomationImpl" />
 
     <bean id="domainManagerImpl" class="com.cloud.user.DomainManagerImpl" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index e48e0b3..1d25851 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -2088,7 +2088,10 @@ public enum Config {
     PublishAsynJobEvent("Advanced", ManagementServer.class, Boolean.class, "publish.async.job.events", "true", "enable or disable publishing of usage events on the event bus", null),
 
     // StatsCollector
-    StatsOutPutGraphiteHost("Advanced", ManagementServer.class, String.class, "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", null);
+    StatsOutPutGraphiteHost("Advanced", ManagementServer.class, String.class, "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", null),
+
+    // Usage Reporting service
+    UsageReportInterval("Advanced", ManagementServer.class, Integer.class, "usage.report.interval", "7", "Interval (days) between sending anonymous Usage Reports back to the CloudStack project", null);
 
     private final String _category;
     private final Class<?> _componentClass;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/server/src/org/apache/cloudstack/report/AtomicGsonAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/report/AtomicGsonAdapter.java b/server/src/org/apache/cloudstack/report/AtomicGsonAdapter.java
new file mode 100644
index 0000000..23d83f1
--- /dev/null
+++ b/server/src/org/apache/cloudstack/report/AtomicGsonAdapter.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.report;
+
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import com.google.common.util.concurrent.AtomicLongMap;
+import java.util.Map;
+import java.io.IOException;
+
+public class AtomicGsonAdapter extends TypeAdapter<AtomicLongMap> {
+
+    public AtomicLongMap<Object> read(JsonReader reader) throws IOException {
+        reader.nextNull();
+        return null;
+    }
+
+    public void write(JsonWriter writer, AtomicLongMap value) throws IOException {
+        if (value == null) {
+            writer.nullValue();
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        Map <String, Long> map = value.asMap();
+
+        writer.beginObject();
+        for (Map.Entry<String, Long> entry : map.entrySet()) {
+            writer.name(entry.getKey()).value(entry.getValue());
+        }
+        writer.endObject();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/server/src/org/apache/cloudstack/report/UsageReporter.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/report/UsageReporter.java b/server/src/org/apache/cloudstack/report/UsageReporter.java
new file mode 100644
index 0000000..4656cc4
--- /dev/null
+++ b/server/src/org/apache/cloudstack/report/UsageReporter.java
@@ -0,0 +1,470 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.report;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.net.SocketTimeoutException;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.io.OutputStreamWriter;
+import java.io.IOException;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.managed.context.ManagedContextRunnable;
+
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
+import org.apache.commons.codec.digest.DigestUtils;
+
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.dao.VMInstanceDao;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.component.ComponentMethodInterceptable;
+import com.cloud.utils.concurrency.NamedThreadFactory;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.TransactionLegacy;
+import com.cloud.upgrade.dao.VersionDao;
+import com.cloud.upgrade.dao.VersionVO;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.DiskOfferingVO;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.common.util.concurrent.AtomicLongMap;
+
+@Component
+public class UsageReporter extends ManagerBase implements ComponentMethodInterceptable {
+    public static final Logger s_logger = Logger.getLogger(UsageReporter.class.getName());
+
+    /* !FIX ME! This should point to a Apache Infra host with SSL! */
+    private String reportHost = "http://cs-report.widodh.nl:8088/report";
+
+    private String uniqueID = null;
+
+    private static UsageReporter s_instance = null;
+
+    private ScheduledExecutorService _executor = null;
+
+    @Inject
+    private ConfigurationDao _configDao;
+    @Inject
+    private HostDao _hostDao;
+    @Inject
+    private ClusterDao _clusterDao;
+    @Inject
+    private PrimaryDataStoreDao _storagePoolDao;
+    @Inject
+    private DataCenterDao _dataCenterDao;
+    @Inject
+    private UserVmDao _userVmDao;
+    @Inject
+    private VMInstanceDao _vmInstance;
+    @Inject
+    private VersionDao _versionDao;
+    @Inject
+    private DiskOfferingDao _diskOfferingDao;
+
+    int usageReportInterval = -1;
+
+    public static UsageReporter getInstance() {
+        return s_instance;
+    }
+
+    public static UsageReporter getInstance(Map<String, String> configs) {
+        s_instance.init(configs);
+        return s_instance;
+    }
+
+    public UsageReporter() {
+        s_instance = this;
+    }
+
+    @Override
+    public boolean start() {
+        init(_configDao.getConfiguration());
+        return true;
+    }
+
+    private void init(Map<String, String> configs) {
+        _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("UsageReporter"));
+
+        usageReportInterval = NumbersUtil.parseInt(configs.get("usage.report.interval"), 7);
+
+        if (usageReportInterval > 0) {
+            _executor.scheduleWithFixedDelay(new UsageCollector(), 7, usageReportInterval, TimeUnit.DAYS);
+        }
+
+        uniqueID = getUniqueId();
+    }
+
+    private void sendReport(String reportUri, String uniqueID, Map<String, Object> reportMap) {
+
+        GsonBuilder builder = new GsonBuilder();
+
+        AtomicGsonAdapter adapter = new AtomicGsonAdapter();
+        builder.registerTypeAdapter(AtomicLongMap.class, adapter);
+
+        Gson gson = builder.create();
+        String report = gson.toJson(reportMap);
+
+        int http_timeout = 15000;
+
+        try {
+            s_logger.info("Usage Report will be send to: " + reportUri);
+            s_logger.debug("REPORT: " + report);
+
+            URL url = new URL(reportUri + "/" + uniqueID);
+
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setConnectTimeout(http_timeout);
+            conn.setReadTimeout(http_timeout);
+            conn.setRequestMethod("POST");
+            conn.setDoOutput(true);
+            conn.setRequestProperty("Content-Type", "application/json");
+            conn.setRequestProperty("Accept", "application/json");
+
+            OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
+            osw.write(report);
+            osw.flush();
+            osw.close();
+
+            int resp_code = conn.getResponseCode();
+
+            if (resp_code == HttpURLConnection.HTTP_OK){
+                s_logger.info("Usage Report succesfully send to: " + reportUri);
+            } else {
+                s_logger.warn("Failed to send Usage Report: " + conn.getResponseMessage());
+            }
+
+        } catch (SocketTimeoutException e) {
+            s_logger.warn("Sending Usage Report to " + reportUri + " timed out: " + e.getMessage());
+        } catch (MalformedURLException e) {
+            s_logger.warn(reportUri + " is a invalid URL for sending Usage Report to: "+ e.getMessage());
+        } catch (ProtocolException e) {
+            s_logger.warn("Sending Usage Report failed due to a invalid protocol: " + e.getMessage());
+        } catch (IOException e) {
+            s_logger.warn("Failed to write Usage Report due to a IOException: " + e.getMessage());
+        }
+    }
+
+    @DB
+    private String getUniqueId() {
+        String unique = null;
+        Connection conn = null;
+
+        try {
+            conn = TransactionLegacy.getStandaloneConnection();
+
+            PreparedStatement pstmt = conn.prepareStatement("SELECT version,updated FROM version ORDER BY id ASC LIMIT 1");
+            ResultSet rs = pstmt.executeQuery();
+            if (rs.next()) {
+                unique = DigestUtils.sha256Hex(rs.getString(1) + rs.getString(2));
+            } else {
+                s_logger.debug("No rows found in the version table. Unable to obtain unique ID for this environment");
+            }
+
+            rs.close();
+        } catch (SQLException e) {
+            s_logger.debug("Unable to get the unique ID of this environment: " + e.getMessage());
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+            }
+        }
+
+        s_logger.debug("Usage Report Unique ID is: " + unique);
+
+        return unique;
+    }
+
+    private Map<String, AtomicLongMap> getHostReport() {
+        Map<String, AtomicLongMap> hostMap = new HashMap<String, AtomicLongMap>();
+        AtomicLongMap<Object> host_types = AtomicLongMap.create();
+        AtomicLongMap<Object> host_hypervisor_type = AtomicLongMap.create();
+        AtomicLongMap<Object> host_version = AtomicLongMap.create();
+
+        SearchCriteria<HostVO> host_sc = _hostDao.createSearchCriteria();
+        List<HostVO> hosts = _hostDao.search(host_sc, null);
+        for (HostVO host : hosts) {
+            host_types.getAndIncrement(host.getType());
+            if (host.getHypervisorType() != null) {
+                host_hypervisor_type.getAndIncrement(host.getHypervisorType());
+            }
+
+            host_version.getAndIncrement(host.getVersion());
+        }
+
+        hostMap.put("version", host_version);
+        hostMap.put("hypervisor_type", host_hypervisor_type);
+        hostMap.put("type", host_types);
+
+        return hostMap;
+    }
+
+    private Map<String, AtomicLongMap> getClusterReport() {
+        Map<String, AtomicLongMap> clusterMap = new HashMap<String, AtomicLongMap>();
+        AtomicLongMap<Object> cluster_hypervisor_type = AtomicLongMap.create();
+        AtomicLongMap<Object> cluster_types = AtomicLongMap.create();
+
+        SearchCriteria<ClusterVO> cluster_sc = _clusterDao.createSearchCriteria();
+        List<ClusterVO> clusters = _clusterDao.search(cluster_sc, null);
+        for (ClusterVO cluster : clusters) {
+            if (cluster.getClusterType() != null) {
+                cluster_types.getAndIncrement(cluster.getClusterType());
+            }
+
+            if (cluster.getHypervisorType() != null) {
+                cluster_hypervisor_type.getAndIncrement(cluster.getHypervisorType());
+            }
+        }
+
+        clusterMap.put("hypervisor_type", cluster_hypervisor_type);
+        clusterMap.put("type", cluster_types);
+
+        return clusterMap;
+    }
+
+    private Map<String, AtomicLongMap> getStoragePoolReport() {
+        Map<String, AtomicLongMap> storagePoolMap = new HashMap<String, AtomicLongMap>();
+        AtomicLongMap<Object> storage_pool_types = AtomicLongMap.create();
+        AtomicLongMap<Object> storage_pool_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> storage_pool_scope = AtomicLongMap.create();
+
+        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
+        for (StoragePoolVO pool : storagePools) {
+            if (pool.getPoolType() != null) {
+                storage_pool_types.getAndIncrement(pool.getPoolType());
+            }
+
+            if (pool.getStorageProviderName() != null) {
+                storage_pool_provider.getAndIncrement(pool.getStorageProviderName());
+            }
+
+            if (pool.getScope() != null) {
+                storage_pool_scope.getAndIncrement(pool.getScope());
+            }
+        }
+
+        storagePoolMap.put("type", storage_pool_types);
+        storagePoolMap.put("provider", storage_pool_provider);
+        storagePoolMap.put("scope", storage_pool_scope);
+
+        return storagePoolMap;
+    }
+
+    private Map<String, AtomicLongMap> getDataCenterReport() {
+        Map<String, AtomicLongMap> datacenterMap = new HashMap<String, AtomicLongMap>();
+        AtomicLongMap<Object> network_type = AtomicLongMap.create();
+        AtomicLongMap<Object> dns_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> dhcp_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> lb_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> firewall_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> gateway_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> userdata_provider = AtomicLongMap.create();
+        AtomicLongMap<Object> vpn_provider = AtomicLongMap.create();
+
+        List<DataCenterVO> datacenters = _dataCenterDao.listAllZones();
+        for (DataCenterVO datacenter : datacenters) {
+            if (datacenter.getNetworkType() != null) {
+                network_type.getAndIncrement(datacenter.getNetworkType());
+            }
+
+            if (datacenter.getDnsProvider() != null) {
+                dns_provider.getAndIncrement(datacenter.getDnsProvider());
+            }
+
+            if (datacenter.getDhcpProvider() != null) {
+                dhcp_provider.getAndIncrement(datacenter.getDhcpProvider());
+            }
+
+            if (datacenter.getLoadBalancerProvider() != null) {
+                lb_provider.getAndIncrement(datacenter.getLoadBalancerProvider());
+            }
+
+            if (datacenter.getFirewallProvider() != null) {
+                firewall_provider.getAndIncrement(datacenter.getFirewallProvider());
+            }
+
+            if (datacenter.getGatewayProvider() != null) {
+                gateway_provider.getAndIncrement(datacenter.getGatewayProvider());
+            }
+
+            if (datacenter.getUserDataProvider() != null) {
+                userdata_provider.getAndIncrement(datacenter.getUserDataProvider());
+            }
+
+            if (datacenter.getVpnProvider() != null) {
+                vpn_provider.getAndIncrement(datacenter.getVpnProvider());
+            }
+        }
+
+        datacenterMap.put("network_type", network_type);
+        datacenterMap.put("dns_provider", dns_provider);
+        datacenterMap.put("dhcp_provider", dhcp_provider);
+        datacenterMap.put("lb_provider", lb_provider);
+        datacenterMap.put("firewall_provider", firewall_provider);
+        datacenterMap.put("gateway_provider", gateway_provider);
+        datacenterMap.put("userdata_provider", userdata_provider);
+        datacenterMap.put("vpn_provider", vpn_provider);
+
+        return datacenterMap;
+    }
+
+    private Map<String, AtomicLongMap> getInstanceReport() {
+
+        Map<String, AtomicLongMap> instanceMap = new HashMap<String, AtomicLongMap>();
+        AtomicLongMap<Object> hypervisor_type = AtomicLongMap.create();
+        AtomicLongMap<Object> instance_state = AtomicLongMap.create();
+        AtomicLongMap<Object> instance_type = AtomicLongMap.create();
+        AtomicLongMap<Object> ha_enabled = AtomicLongMap.create();
+        AtomicLongMap<Object> dynamically_scalable = AtomicLongMap.create();
+
+        SearchCriteria<HostVO> host_sc = _hostDao.createSearchCriteria();
+        List<HostVO> hosts = _hostDao.search(host_sc, null);
+        for (HostVO host : hosts) {
+            List<UserVmVO> vms = _userVmDao.listByLastHostId(host.getId());
+            for (UserVmVO vm : vms) {
+                VMInstanceVO vmVO = _vmInstance.findById(vm.getId());
+
+                if (vmVO.getHypervisorType() != null) {
+                    hypervisor_type.getAndIncrement(vmVO.getHypervisorType());
+                }
+
+                if (vmVO.getState() != null) {
+                    instance_state.getAndIncrement(vmVO.getState());
+                }
+
+                if (vmVO.getType() != null) {
+                    instance_type.getAndIncrement(vmVO.getType());
+                }
+
+                ha_enabled.getAndIncrement(vmVO.isHaEnabled());
+                dynamically_scalable.getAndIncrement(vmVO.isDynamicallyScalable());
+            }
+        }
+
+        instanceMap.put("hypervisor_type", hypervisor_type);
+        instanceMap.put("state", instance_state);
+        instanceMap.put("type", instance_type);
+        instanceMap.put("ha_enabled", ha_enabled);
+        instanceMap.put("dynamically_scalable", dynamically_scalable);
+
+        return instanceMap;
+    }
+
+    private Map<String, Object> getDiskOfferingReport() {
+        Map<String, Object> diskOfferingReport = new HashMap<String, Object>();
+
+        AtomicLongMap<Object> system_use = AtomicLongMap.create();
+        AtomicLongMap<Object> provisioning_type = AtomicLongMap.create();
+        AtomicLongMap<Object> use_local_storage = AtomicLongMap.create();
+
+        List<DiskOfferingVO> private_offerings = _diskOfferingDao.findPrivateDiskOffering();
+        List<DiskOfferingVO> public_offerings = _diskOfferingDao.findPublicDiskOfferings();
+
+        List<DiskOfferingVO> offerings = new ArrayList<DiskOfferingVO>();
+        offerings.addAll(private_offerings);
+        offerings.addAll(public_offerings);
+
+        long disk_size = 0;
+        for (DiskOfferingVO offering : offerings) {
+            provisioning_type.getAndIncrement(offering.getProvisioningType());
+            system_use.getAndIncrement(offering.getSystemUse());
+            use_local_storage.getAndIncrement(offering.getUseLocalStorage());
+            disk_size += offering.getDiskSize();
+        }
+
+        diskOfferingReport.put("system_use", system_use);
+        diskOfferingReport.put("provisioning_type", provisioning_type);
+        diskOfferingReport.put("use_local_storage", use_local_storage);
+        diskOfferingReport.put("avg_disk_size", disk_size / offerings.size());
+
+        return diskOfferingReport;
+    }
+
+    private Map<String, String> getVersionReport() {
+        Map<String, String> versionMap = new HashMap<String, String>();
+
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+
+        List<VersionVO> versions = _versionDao.getAllVersions();
+        for (VersionVO version : versions) {
+            versionMap.put(version.getVersion(), dateFormat.format(version.getUpdated()));
+        }
+
+        return versionMap;
+    }
+
+    private String getCurrentVersion() {
+        return _versionDao.getCurrentVersion();
+    }
+
+    class UsageCollector extends ManagedContextRunnable {
+        @Override
+        protected void runInContext() {
+            try {
+                s_logger.warn("UsageReporter is running...");
+
+                Map<String, Object> reportMap = new HashMap<String, Object>();
+
+                reportMap.put("hosts", getHostReport());
+                reportMap.put("clusters", getClusterReport());
+                reportMap.put("primaryStorage", getStoragePoolReport());
+                reportMap.put("zones", getDataCenterReport());
+                reportMap.put("instances", getInstanceReport());
+                reportMap.put("diskOffering", getDiskOfferingReport());
+                reportMap.put("versions", getVersionReport());
+                reportMap.put("current_version", getCurrentVersion());
+
+                sendReport(reportHost, uniqueID, reportMap);
+
+            } catch (Exception e) {
+                s_logger.warn("Failed to compile Usage Report: " + e.getMessage());
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c997847/setup/db/db/schema-451to460.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-451to460.sql b/setup/db/db/schema-451to460.sql
index 0abd4f8..00204f0 100644
--- a/setup/db/db/schema-451to460.sql
+++ b/setup/db/db/schema-451to460.sql
@@ -398,3 +398,5 @@ CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
   CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
   CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "usage.report.interval", 7, "Interval (days) between sending anonymous Usage Reports back to the CloudStack project", "", NULL, NULL, 0);


[10/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
systemvmtemplate: install open-vm-tools from wheezy-backports, install XStools

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d8eb2e5e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d8eb2e5e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d8eb2e5e

Branch: refs/heads/reporter
Commit: d8eb2e5e48d59897acf431e4c42f493a194e2111
Parents: 770297e
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri Apr 10 15:48:36 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Apr 10 15:48:36 2015 +0530

----------------------------------------------------------------------
 .../install_systemvm_packages.sh                | 24 ++++++--------------
 1 file changed, 7 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d8eb2e5e/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index 1804a58..fc90eba 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -70,38 +70,28 @@ function install_packages() {
     openjdk-7-jre-headless \
     iptables-persistent \
     libtcnative-1 libssl-dev libapr1-dev \
-    open-vm-tools \
     python-flask \
     haproxy \
     radvd \
     sharutils
 
-  ${apt_get} -t wheezy-backports install irqbalance
+  ${apt_get} -t wheezy-backports install irqbalance open-vm-tools
 
   # hold on installed openswan version, upgrade rest of the packages (if any)
   apt-mark hold openswan
   apt-get update
   apt-get -y --force-yes upgrade
 
-  # commented out installation of vmware-tools as we are using the open source open-vm-tools:
-  # ${apt_get} install build-essential linux-headers-`uname -r`
-  # df -h
-  # PREVDIR=$PWD
-  # cd /opt
-  # wget http://people.apache.org/~bhaisaab/cloudstack/VMwareTools-9.2.1-818201.tar.gz
-  # tar xzf VMwareTools-9.2.1-818201.tar.gz
-  # rm VMwareTools-*.tar.gz
-  # cd vmware-tools-distrib
-  # ./vmware-install.pl -d
-  # cd $PREV
-  # rm -fr /opt/vmware-tools-distrib
-  # apt-get -q -y --force-yes purge build-essential
-
-  # Hyperv  kvp daemon - 64bit only
   if [ "${arch}" == "amd64" ]; then
+    # Hyperv  kvp daemon - 64bit only
     # Download the hv kvp daemon
     wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
     dpkg -i hv-kvp-daemon_3.1_amd64.deb
+    rm -f hv-kvp-daemon_3.1_amd64.deb
+    # XS tools
+    wget https://raw.githubusercontent.com/bhaisaab/cloudstack-nonoss/master/xe-guest-utilities_6.5.0_amd64.deb
+    dpkg -i xe-guest-utilities_6.5.0_amd64.deb
+    rm -f xe-guest-utilities_6.5.0_amd64.deb
   fi
 }
 


[40/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CreateVMSnapshot: fix typo in API description

This closes #161


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4a424500
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4a424500
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4a424500

Branch: refs/heads/reporter
Commit: 4a424500f3689b3fddc21750cb841239107b2a46
Parents: cd67382
Author: Rene Moser <re...@apache.org>
Authored: Mon Apr 13 18:54:33 2015 +0200
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Mon Apr 13 20:26:26 2015 +0200

----------------------------------------------------------------------
 .../api/command/user/vmsnapshot/CreateVMSnapshotCmd.java           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a424500/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
index 10ff5cd..f18793a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
@@ -47,7 +47,7 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
     @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType = UserVmResponse.class, description = "The ID of the vm")
     private Long vmId;
 
-    @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The discription of the snapshot")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The description of the snapshot")
     private String description;
 
     @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot")


[44/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8386: CS is returning sec. storage even if it is full and there are other sec. storage with free space.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/30604e97
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/30604e97
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/30604e97

Branch: refs/heads/reporter
Commit: 30604e973afab20bca87346208bf71e8c936ff3b
Parents: 8f4abbc
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Mon Apr 13 10:56:46 2015 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Tue Apr 14 16:10:40 2015 +0530

----------------------------------------------------------------------
 .../allocator/StorageCacheRandomAllocator.java  | 20 ++++++++----------
 .../manager/ImageStoreProviderManagerImpl.java  | 22 ++++++++++++++++++++
 .../storage/datastore/DataStoreManagerImpl.java |  7 ++-----
 .../datastore/ImageStoreProviderManager.java    |  2 ++
 server/src/com/cloud/server/StatsCollector.java |  9 ++++++++
 .../template/HypervisorTemplateAdapter.java     | 13 +++++++++---
 6 files changed, 54 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/engine/storage/cache/src/org/apache/cloudstack/storage/cache/allocator/StorageCacheRandomAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/allocator/StorageCacheRandomAllocator.java b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/allocator/StorageCacheRandomAllocator.java
index ba1ee3c..c9832bf 100644
--- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/allocator/StorageCacheRandomAllocator.java
+++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/allocator/StorageCacheRandomAllocator.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cloudstack.storage.cache.allocator;
 
-import java.util.Collections;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -33,7 +32,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
 import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
+import org.apache.cloudstack.storage.image.datastore.ImageStoreProviderManager;
 
+import com.cloud.server.StatsCollector;
 import com.cloud.storage.ScopeType;
 
 @Component
@@ -43,6 +44,10 @@ public class StorageCacheRandomAllocator implements StorageCacheAllocator {
     DataStoreManager dataStoreMgr;
     @Inject
     ObjectInDataStoreManager objectInStoreMgr;
+    @Inject
+    ImageStoreProviderManager imageStoreMgr;
+    @Inject
+    StatsCollector statsCollector;
 
     @Override
     public DataStore getCacheStore(Scope scope) {
@@ -57,8 +62,7 @@ public class StorageCacheRandomAllocator implements StorageCacheAllocator {
             return null;
         }
 
-        Collections.shuffle(cacheStores);
-        return cacheStores.get(0);
+        return imageStoreMgr.getImageStore(cacheStores);
     }
 
     @Override
@@ -78,18 +82,12 @@ public class StorageCacheRandomAllocator implements StorageCacheAllocator {
         if (cacheStores.size() > 1) {
             for (DataStore store : cacheStores) {
                 DataObjectInStore obj = objectInStoreMgr.findObject(data, store);
-                if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready) {
+                if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready && statsCollector.imageStoreHasEnoughCapacity(store)) {
                     s_logger.debug("pick the cache store " + store.getId() + " where data is already there");
                     return store;
                 }
             }
-
-            // otherwise, just random pick one
-            Collections.shuffle(cacheStores);
         }
-        return cacheStores.get(0);
-
+        return imageStoreMgr.getImageStore(cacheStores);
     }
-
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
index 882cf18..cb9a97e 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
@@ -19,7 +19,9 @@
 package org.apache.cloudstack.storage.image.manager;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -41,6 +43,7 @@ import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
 import org.apache.cloudstack.storage.image.datastore.ImageStoreProviderManager;
 import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
 
+import com.cloud.server.StatsCollector;
 import com.cloud.storage.ScopeType;
 import com.cloud.storage.dao.VMTemplateDao;
 
@@ -53,6 +56,8 @@ public class ImageStoreProviderManagerImpl implements ImageStoreProviderManager
     VMTemplateDao imageDataDao;
     @Inject
     DataStoreProviderManager providerManager;
+    @Inject
+    StatsCollector _statsCollector;
     Map<String, ImageStoreDriver> driverMaps;
 
     @PostConstruct
@@ -137,4 +142,21 @@ public class ImageStoreProviderManagerImpl implements ImageStoreProviderManager
         }
         return imageStores;
     }
+
+    @Override
+    public DataStore getImageStore(List<DataStore> imageStores) {
+        if (imageStores.size() > 1) {
+            Collections.shuffle(imageStores); // Randomize image store list.
+            Iterator<DataStore> i = imageStores.iterator();
+            DataStore imageStore = null;
+            while(i.hasNext()) {
+                imageStore = i.next();
+                // Return image store if used percentage is less then threshold value i.e. 90%.
+                if (_statsCollector.imageStoreHasEnoughCapacity(imageStore)) {
+                    return imageStore;
+                }
+            }
+        }
+        return imageStores.get(0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
index d44fb42..aa23a43 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cloudstack.storage.datastore;
 
-import java.util.Collections;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -79,8 +78,7 @@ public class DataStoreManagerImpl implements DataStoreManager {
         if (stores == null || stores.size() == 0) {
             return null;
         }
-        Collections.shuffle(stores);
-        return stores.get(0);
+        return imageDataStoreMgr.getImageStore(stores);
     }
 
     @Override
@@ -112,8 +110,7 @@ public class DataStoreManagerImpl implements DataStoreManager {
         if (stores == null || stores.size() == 0) {
             return null;
         }
-        Collections.shuffle(stores);
-        return stores.get(0);
+        return imageDataStoreMgr.getImageStore(stores);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
index 8afb3d9..70b7a7c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
@@ -41,4 +41,6 @@ public interface ImageStoreProviderManager {
     List<DataStore> listImageCacheStores(Scope scope);
 
     boolean registerDriver(String uuid, ImageStoreDriver driver);
+
+    DataStore getImageStore(List<DataStore> imageStores);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 60c25f0..9f3c8cb 100644
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -212,6 +212,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
     long autoScaleStatsInterval = -1L;
     int vmDiskStatsInterval = 0;
     List<Long> hostIds = null;
+    private double _imageStoreCapacityThreshold = 0.90;
 
     String externalStatsPrefix = "";
     String externalStatsHost = null;
@@ -1045,6 +1046,14 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
         }
     }
 
+    public boolean imageStoreHasEnoughCapacity(DataStore imageStore) {
+        StorageStats imageStoreStats = _storageStats.get(imageStore.getId());
+        if (imageStoreStats != null && (imageStoreStats.getByteUsed()/(imageStoreStats.getCapacityBytes()*1.0)) <= _imageStoreCapacityThreshold) {
+            return true;
+        }
+        return false;
+    }
+
     public StorageStats getStorageStats(long id) {
         return _storageStats.get(id);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30604e97/server/src/com/cloud/template/HypervisorTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
index 42f4b55..e58edb9 100644
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -60,6 +60,7 @@ import com.cloud.event.UsageEventUtils;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.org.Grouping;
+import com.cloud.server.StatsCollector;
 import com.cloud.storage.ScopeType;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.TemplateType;
@@ -83,8 +84,10 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
     DownloadMonitor _downloadMonitor;
     @Inject
     AgentManager _agentMgr;
-
-    @Inject TemplateDataStoreDao templateDataStoreDao;
+    @Inject
+    StatsCollector _statsCollector;
+    @Inject
+    TemplateDataStoreDao templateDataStoreDao;
     @Inject
     DataStoreManager storeMgr;
     @Inject
@@ -164,13 +167,17 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
                     continue;
                 }
 
+                // Check if image store has enough capacity for template
+                if (!_statsCollector.imageStoreHasEnoughCapacity(imageStore)) {
+                    s_logger.info("Image store doesn't has enough capacity, so skip downloading template to this image store " + imageStore.getId());
+                    continue;
+                }
                 // We want to download private template to one of the image store in a zone
                 if(isPrivateTemplate(template) && zoneSet.contains(zoneId)){
                     continue;
                 }else {
                     zoneSet.add(zoneId);
                 }
-
             }
 
             TemplateInfo tmpl = imageFactory.getTemplate(template.getId(), imageStore);


[27/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-6543 Sort domain lists in UI

As recently discussed on the dev list:
This sorts the domain lists based on their path.
Especially handy when having a lot of domains,
like in a public cloud.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a7f8059f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a7f8059f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a7f8059f

Branch: refs/heads/reporter
Commit: a7f8059fd35dae42a04583b4333b28ec0d68218a
Parents: c158cff
Author: Remi Bergsma <rb...@schubergphilis.com>
Authored: Sun Apr 12 23:20:29 2015 -0500
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Sun Apr 12 23:21:43 2015 -0500

----------------------------------------------------------------------
 ui/scripts/accounts.js        |  3 +++
 ui/scripts/accountsWizard.js  |  3 +++
 ui/scripts/configuration.js   |  9 +++++++++
 ui/scripts/events.js          |  3 +++
 ui/scripts/instances.js       |  6 ++++++
 ui/scripts/network.js         |  9 +++++++++
 ui/scripts/projects.js        |  3 +++
 ui/scripts/regions.js         |  3 +++
 ui/scripts/sharedFunctions.js |  3 +++
 ui/scripts/storage.js         |  6 ++++++
 ui/scripts/system.js          | 27 ++++++++++++++++++++++++---
 11 files changed, 72 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 62ed4b8..d539af4 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -1561,6 +1561,9 @@
                                                                 description: this.path
                                                             });
                                                         });
+                                                        items.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
                                                         args.response.success({
                                                             data: items
                                                         });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/accountsWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js
index 6b0dd19..82e7eab 100644
--- a/ui/scripts/accountsWizard.js
+++ b/ui/scripts/accountsWizard.js
@@ -92,6 +92,9 @@
                                 if (this.level === 0)
                                     rootDomainId = this.id;
                             });
+                            items.sort(function(a, b) {
+                                return a.description.localeCompare(b.description);
+                            });
                             args.response.success({
                                 data: items
                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index ceb0485..184e38a 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -573,6 +573,9 @@
                                                             description: this.path
                                                         });
                                                     });
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
                                                     args.response.success({
                                                         data: items
                                                     });
@@ -1220,6 +1223,9 @@
                                                             description: this.path
                                                         });
                                                     });
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
                                                     args.response.success({
                                                         data: items
                                                     });
@@ -1893,6 +1899,9 @@
                                                             description: this.path
                                                         });
                                                     });
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
                                                     args.response.success({
                                                         data: items
                                                     });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/events.js
----------------------------------------------------------------------
diff --git a/ui/scripts/events.js b/ui/scripts/events.js
index a15f996..9280429 100644
--- a/ui/scripts/events.js
+++ b/ui/scripts/events.js
@@ -301,6 +301,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index de0cff7..81732d7 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -236,6 +236,9 @@
                                             });
                                         }
                                     }
+                                    array1.sort(function(a, b) {
+                                        return a.description.localeCompare(b.description);
+                                    });
                                     args.response.success({
                                         data: array1
                                     });
@@ -1758,6 +1761,9 @@
             				                            });
             				                        }
             				                    }
+                                                            array1.sort(function(a, b) {
+                                                                return a.description.localeCompare(b.description);
+                                                            });
             				                    args.response.success({
             				                        data: array1
             				                    });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index f62502f..3ae3a73 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -656,6 +656,9 @@
                                                                 description: this.path
                                                             });
                                                         });
+                                                        items.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
                                                         args.response.success({
                                                             data: items
                                                         });
@@ -830,6 +833,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });
@@ -5254,6 +5260,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/projects.js
----------------------------------------------------------------------
diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js
index 74812a1..86e4f88 100644
--- a/ui/scripts/projects.js
+++ b/ui/scripts/projects.js
@@ -734,6 +734,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index fab43e6..f7cb8fd 100644
--- a/ui/scripts/regions.js
+++ b/ui/scripts/regions.js
@@ -377,6 +377,9 @@
                                                                 });
                                                             }
                                                         }
+                                                        array1.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
                                                         args.response.success({
                                                             data: array1
                                                         });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 2d1977e..e8f7cc9 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -483,6 +483,9 @@ var addGuestNetworkDialog = {
                                 }
                             });
                         }
+                        items.sort(function(a, b) {
+                            return a.description.localeCompare(b.description);
+                        });
                         args.response.success({
                             data: items
                         });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index feda21c..1773c27 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -467,6 +467,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });
@@ -1743,6 +1746,9 @@
                                                     });
                                                 }
                                             }
+                                            array1.sort(function(a, b) {
+                                                return a.description.localeCompare(b.description);
+                                            });
                                             args.response.success({
                                                 data: array1
                                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7f8059f/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index b1aafaa..5e6adcf 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7958,7 +7958,10 @@
                                                                         description: this.name
                                                                     });
                                                                 });
-                                                                
+                                                                items.sort(function(a, b) {
+                                                                    return a.description.localeCompare(b.description);
+                                                                });
+
                                                                 args.response.success({
                                                                     data: items
                                                                 });
@@ -13246,6 +13249,9 @@
                                                             description: this.name
                                                         });
                                                     });
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
                                                     
                                                     args.response.success({
                                                         data: items
@@ -13461,7 +13467,10 @@
                                                                 description: this.name
                                                             });
                                                         });
-                                                        
+                                                        items.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
+
                                                         args.response.success({
                                                             data: items
                                                         });
@@ -14059,7 +14068,10 @@
                                                             description: this.name
                                                         });
                                                     });
-                                                    
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
+
                                                     args.response.success({
                                                         data: items
                                                     });
@@ -14614,6 +14626,9 @@
                                                                 description: this.name
                                                             });
                                                         });
+                                                        items.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
                                                         
                                                         args.response.success({
                                                             data: items
@@ -15501,6 +15516,9 @@
                                                             description: this.name
                                                         });
                                                     });
+                                                    items.sort(function(a, b) {
+                                                        return a.description.localeCompare(b.description);
+                                                    });
                                                     
                                                     args.response.success({
                                                         data: items
@@ -15831,6 +15849,9 @@
                                                                 description: this.name
                                                             });
                                                         });
+                                                        items.sort(function(a, b) {
+                                                            return a.description.localeCompare(b.description);
+                                                        });
                                                         
                                                         args.response.success({
                                                             data: items


[37/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8375: Marvin - Code Improvement - related to verifying VCenter port groups corresponding to traffic types in a zone

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4d05c3b9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4d05c3b9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4d05c3b9

Branch: refs/heads/reporter
Commit: 4d05c3b966bf709bab820a6f84483d780e204197
Parents: ccf13ec
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Sat Apr 11 14:37:28 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Apr 13 16:58:13 2015 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/codes.py      |   5 ++
 tools/marvin/marvin/lib/common.py | 139 ++++++++++++++++++++++++---------
 2 files changed, 108 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d05c3b9/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index 3f9ee2f..921b619 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -127,3 +127,8 @@ PUBLIC_TRAFFIC = "public"
 GUEST_TRAFFIC = "guest"
 MANAGEMENT_TRAFFIC = "management"
 STORAGE_TRAFFIC = "storage"
+
+'''
+Switch Type
+'''
+VMWAREDVS = "vmwaredvs"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d05c3b9/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 6efd58b..d1dd856 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -62,8 +62,11 @@ from marvin.codes import (PASS, FAILED, ISOLATED_NETWORK, VPC_NETWORK,
                           BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE,
                           RESOURCE_PRIMARY_STORAGE, RESOURCE_SECONDARY_STORAGE,
                           RESOURCE_CPU, RESOURCE_MEMORY, PUBLIC_TRAFFIC,
-                          GUEST_TRAFFIC, MANAGEMENT_TRAFFIC, STORAGE_TRAFFIC)
-from marvin.lib.utils import (validateList, xsplit, get_process_status)
+                          GUEST_TRAFFIC, MANAGEMENT_TRAFFIC, STORAGE_TRAFFIC,
+                          VMWAREDVS)
+from marvin.lib.utils import (validateList,
+                              xsplit,
+                              get_process_status)
 from marvin.lib.base import (PhysicalNetwork,
                              PublicIPAddress,
                              NetworkOffering,
@@ -85,6 +88,8 @@ from marvin.lib.base import (PhysicalNetwork,
                              PublicIpRange,
                              StorageNetworkIpRange,
                              TrafficType)
+from marvin.lib.vcenter import Vcenter
+from netaddr import IPAddress
 import random
 import re
 import itertools
@@ -1422,7 +1427,61 @@ def verifyRouterState(apiclient, routerid, state, listall=True):
         return [exceptionOccured, isRouterInDesiredState, exceptionMessage]
     return [exceptionOccured, isRouterInDesiredState, exceptionMessage]
 
-def analyzeTrafficType(trafficTypes, trafficTypeToFilter):
+def isIpRangeInUse(api_client, publicIpRange):
+    ''' Check that if any Ip in the IP Range is in use
+        currently
+    '''
+
+    vmList = VirtualMachine.list(api_client,
+                                 zoneid=publicIpRange.zoneid,
+                                 listall=True)
+    if not vmList:
+        return False
+
+    for vm in vmList:
+        for nic in vm.nic:
+            publicIpAddresses = PublicIPAddress.list(api_client,
+                                                 associatednetworkid=nic.networkid,
+                                                 listall=True)
+            if validateList(publicIpAddresses)[0] == PASS:
+                for ipaddress in publicIpAddresses:
+                    if IPAddress(publicIpRange.startip) <=\
+                        IPAddress(ipaddress.ipaddress) <=\
+                        IPAddress(publicIpRange.endip):
+                        return True
+    return False
+
+def verifyGuestTrafficPortGroups(api_client, config, setup_zone):
+
+    """ This function matches the given zone with
+    the zone in config file used to deploy the setup and
+    retrieves the corresponding vcenter details and forms
+    the vcenter connection object. It makes call to
+    verify the guest traffic for given zone """
+
+    try:
+        zoneDetailsInConfig = [zone for zone in config.zones
+                if zone.name == setup_zone.name][0]
+        vcenterusername = zoneDetailsInConfig.vmwaredc.username
+        vcenterpassword = zoneDetailsInConfig.vmwaredc.password
+        vcenterip = zoneDetailsInConfig.vmwaredc.vcenter
+        vcenterObj = Vcenter(
+                vcenterip,
+                vcenterusername,
+                vcenterpassword)
+        response = verifyVCenterPortGroups(
+                api_client,
+                vcenterObj,
+                traffic_types_to_validate=[
+                    GUEST_TRAFFIC],
+                zoneid=setup_zone.id,
+                switchTypes=[VMWAREDVS])
+        assert response[0] == PASS, response[1]
+    except Exception as e:
+        return [FAIL, e]
+    return [PASS, None]
+
+def analyzeTrafficType(trafficTypes, trafficTypeToFilter, switchTypes=None):
     """ Analyze traffic types for given type and return
         switch name and vlan Id from the
         vmwarenetworklabel string of trafficTypeToFilter
@@ -1442,6 +1501,10 @@ def analyzeTrafficType(trafficTypes, trafficTypeToFilter):
             filteredList[0].vmwarenetworklabel).split(",")
         switchName = splitString[0]
         vlanSpecified = splitString[1]
+        availableSwitchType = splitString[2]
+
+        if switchTypes and availableSwitchType.lower() not in switchTypes:
+            return [PASS, None, None, None]
 
         return [PASS, filteredList, switchName, vlanSpecified]
     except Exception as e:
@@ -1493,18 +1556,21 @@ def getExpectedPortGroupNames(
                     vlanInIpRange = re.findall(
                         '\d+',
                         str(publicIpRange.vlan))
+                    vlanId = "untagged"
                     if len(vlanInIpRange) > 0:
                         vlanId = vlanInIpRange[0]
+                    ipRangeInUse = isIpRangeInUse(api_client, publicIpRange)
+                    if ipRangeInUse:
                         expectedDVPortGroupName = "cloud" + "." + \
-                            PUBLIC_TRAFFIC + "." + vlanId + "." + \
-                            network_rate + "." + "1" + "-" + \
-                            switch_name
+                                    PUBLIC_TRAFFIC + "." + vlanId + "." + \
+                                    network_rate + "." + "1" + "-" + \
+                                    switch_name
                         expectedDVPortGroupNames.append(
-                            expectedDVPortGroupName)
+                                    expectedDVPortGroupName)
 
-            expectedDVPortGroupName = "cloud" + "." + PUBLIC_TRAFFIC + "." + \
-                vlanId + "." + "0" + "." + "1" + "-" + switch_name
-            expectedDVPortGroupNames.append(expectedDVPortGroupName)
+                    expectedDVPortGroupName = "cloud" + "." + PUBLIC_TRAFFIC + "." + \
+                            vlanId + "." + "0" + "." + "1" + "-" + switch_name
+                    expectedDVPortGroupNames.append(expectedDVPortGroupName)
 
         if traffic_type == GUEST_TRAFFIC:
 
@@ -1588,8 +1654,9 @@ def getExpectedPortGroupNames(
 def verifyVCenterPortGroups(
         api_client,
         vcenter_conn,
-        zone_list,
-        traffic_types_to_validate):
+        zoneid,
+        traffic_types_to_validate,
+        switchTypes):
 
     """ Generate expected port groups for given traffic types and
         verify they are present in the vcenter
@@ -1598,9 +1665,12 @@ def verifyVCenterPortGroups(
         @api_client:    API client of root admin account
         @vcenter_conn:  connection object for vcenter used to fetch data
                         using vcenterAPI
-        @zone_list:     List of zones for which port groups are to be verified
-        traffic_types:  Traffic types (public, guest, management, storage) for
+        @zone_id:       Zone for which port groups are to be verified
+        @traffic_types_to_validate:
+                        Traffic types (public, guest, management, storage) for
                         which verification is to be done
+        @switchTypes:   The switch types for which port groups
+                        are to be verified e.g vmwaredvs
 
         Return value:
         [PASS/FAIL, exception message if FAIL else None]
@@ -1614,38 +1684,35 @@ def verifyVCenterPortGroups(
         )
         networkRate = config[0].value
         switchDict = {}
-        for zone in zone_list:
-            # Verify that there should be at least one physical
-            # network present in zone.
-            physicalNetworks = PhysicalNetwork.list(
+        physicalNetworks = PhysicalNetwork.list(
                 api_client,
-                zoneid=zone.id
+                zoneid=zoneid
             )
-            assert validateList(physicalNetworks)[0] == PASS,\
+        assert validateList(physicalNetworks)[0] == PASS,\
                 "listPhysicalNetworks returned invalid object in response."
 
-            for physicalNetwork in physicalNetworks:
-                trafficTypes = TrafficType.list(
+        for physicalNetwork in physicalNetworks:
+            trafficTypes = TrafficType.list(
                     api_client,
                     physicalnetworkid=physicalNetwork.id)
 
-                for trafficType in traffic_types_to_validate:
-                    response = analyzeTrafficType(
-                        trafficTypes, trafficType)
-                    assert response[0] == PASS, response[1]
-                    filteredList, switchName, vlanSpecified =\
+            for trafficType in traffic_types_to_validate:
+                response = analyzeTrafficType(
+                        trafficTypes, trafficType, switchTypes)
+                assert response[0] == PASS, response[1]
+                filteredList, switchName, vlanSpecified=\
                         response[1], response[2], response[3]
 
-                    if not filteredList:
-                        continue
+                if not filteredList:
+                    continue
 
-                    if switchName not in switchDict:
-                        dvswitches = vcenter_conn.get_dvswitches(
+                if switchName not in switchDict:
+                    dvswitches = vcenter_conn.get_dvswitches(
                             name=switchName)
-                        switchDict[switchName] = dvswitches[0][
+                    switchDict[switchName] = dvswitches[0][
                             'dvswitch']['portgroupNameList']
 
-                    response = getExpectedPortGroupNames(
+                response = getExpectedPortGroupNames(
                         api_client,
                         physicalNetwork,
                         networkRate,
@@ -1655,9 +1722,9 @@ def verifyVCenterPortGroups(
                         vcenter_conn,
                         vlanSpecified,
                         trafficType)
-                    assert response[0] == PASS, response[1]
-                    dvPortGroups = response[1]
-                    expectedDVPortGroupNames.extend(dvPortGroups)
+                assert response[0] == PASS, response[1]
+                dvPortGroups = response[1]
+                expectedDVPortGroupNames.extend(dvPortGroups)
 
         vcenterPortGroups = list(itertools.chain(*(switchDict.values())))
 


[50/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
CLOUDSTACK-8313: Allow overprovisioning of local storage pools


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9836ccdc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9836ccdc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9836ccdc

Branch: refs/heads/reporter
Commit: 9836ccdcf3b339718676847c1cfaee80cbffc1ca
Parents: 2fad87d
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Tue Mar 10 14:46:21 2015 +0100
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Tue Apr 14 17:30:27 2015 +0200

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9836ccdc/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index d72cc69..fafcdcd 100644
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1600,7 +1600,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
         }
 
         long totalOverProvCapacity;
-        if (pool.getPoolType() == StoragePoolType.NetworkFilesystem || pool.getPoolType() == StoragePoolType.VMFS) {
+        if (pool.getPoolType() == StoragePoolType.NetworkFilesystem || pool.getPoolType() == StoragePoolType.VMFS || pool.getPoolType() == StoragePoolType.Filesystem) {
             BigDecimal overProvFactor = getStorageOverProvisioningFactor(pool.getId());
             totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(pool.getCapacityBytes())).longValue();
             s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString() + " with overprovisioning factor "


[12/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/files/default/createtmplt.sh
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/files/default/createtmplt.sh b/tools/devcloud4/common/development-installation/files/default/createtmplt.sh
new file mode 100755
index 0000000..6b31232
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/files/default/createtmplt.sh
@@ -0,0 +1,239 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ 
+
+# $Id: createtmplt.sh 9132 2010-06-04 20:17:43Z manuel $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/secondary/createtmplt.sh $
+# createtmplt.sh -- install a template
+
+usage() {
+  printf "Usage: %s: -t <template-fs> -n <templatename> -f <root disk file> -c <md5 cksum> -d <descr> -h  [-u] [-v]\n" $(basename $0) >&2
+}
+
+
+#set -x
+ulimit -f 41943040 #40GiB in blocks
+ulimit -c 0
+
+rollback_if_needed() {
+  if [ $2 -gt 0 ]
+  then
+    printf "$3\n"
+    #back out all changes
+    rm -rf $1
+    exit 2
+fi
+}
+
+verify_cksum() {
+  echo  "$1  $2" | md5sum  -c --status
+  #printf "$1\t$2" | md5sum  -c --status
+  if [ $? -gt 0 ] 
+  then
+    printf "Checksum failed, not proceeding with install\n"
+    exit 3
+  fi
+}
+
+untar() {
+  local ft=$(file $1| awk -F" " '{print $2}')
+  case $ft in
+  USTAR) 
+     printf "tar archives not supported\n"  >&2
+     return 1
+          ;;
+  *) printf "$1"
+     return 0
+	  ;;
+  esac
+
+}
+
+is_compressed() {
+  local ft=$(file $1| awk -F" " '{print $2}')
+  local tmpfile=${1}.tmp
+
+  case $ft in
+  gzip)  ctype="gzip"
+         ;;
+  bzip2)  ctype="bz2"
+         ;;
+  ZIP)  ctype="zip"
+        ;;
+    *) echo "File $1 does not appear to be compressed" >&2
+        return 1
+	;;
+  esac
+  echo "Uncompressing to $tmpfile (type $ctype)...could take a long time" >&2
+  return 0
+}
+
+uncompress() {
+  local ft=$(file $1| awk -F" " '{print $2}')
+  local tmpfile=${1}.tmp
+
+  case $ft in
+  gzip)  gunzip -q -c $1 > $tmpfile
+         ;;
+  bzip2)  bunzip2 -q -c $1 > $tmpfile
+         ;;
+  ZIP)  unzip -q -p $1 | cat > $tmpfile
+        ;;
+    *) printf "$1"
+       return 0
+	;;
+  esac
+
+  if [ $? -gt 0 ] 
+  then
+    printf "Failed to uncompress file (filetype=$ft), exiting "
+    return 1 
+  fi
+ 
+  rm -f $1
+  printf $tmpfile
+
+  return 0
+}
+
+create_from_file() {
+  local tmpltfs=$1
+  local tmpltimg=$2
+  local tmpltname=$3
+
+  [ -n "$verbose" ] && echo "Moving to $tmpltfs/$tmpltname...could take a while" >&2
+  mv $tmpltimg /$tmpltfs/$tmpltname
+
+}
+
+tflag=
+nflag=
+fflag=
+sflag=
+hflag=
+hvm=false
+cleanup=false
+dflag=
+cflag=
+
+while getopts 'vuht:n:f:s:c:d:S:' OPTION
+do
+  case $OPTION in
+  t)	tflag=1
+		tmpltfs="$OPTARG"
+		;;
+  n)	nflag=1
+		tmpltname="$OPTARG"
+		;;
+  f)	fflag=1
+		tmpltimg="$OPTARG"
+		;;
+  s)	sflag=1
+		;;
+  c)	cflag=1
+		cksum="$OPTARG"
+		;;
+  d)	dflag=1
+		descr="$OPTARG"
+		;;
+  S)	Sflag=1
+		size=$OPTARG
+                let "size>>=10"
+		ulimit -f $size
+		;;
+  h)	hflag=1
+		hvm="true"
+		;;
+  u)	cleanup="true"
+		;;
+  v)	verbose="true"
+		;;
+  ?)	usage
+		exit 2
+		;;
+  esac
+done
+
+isCifs() {
+   #TO:DO incase of multiple zone where cifs and nfs exists, 
+   #then check if the template file is from cifs using df -P filename
+   #Currently only cifs is supported in hyperv zone.
+   mount | grep "type cifs" > /dev/null
+   echo $?
+}
+
+if [ "$tflag$nflag$fflag$sflag" != "1111" ]
+then
+ usage
+ exit 2
+fi
+
+mkdir -p $tmpltfs
+
+if [ ! -f $tmpltimg ] 
+then
+  printf "root disk file $tmpltimg doesn't exist\n"
+  exit 3
+fi
+
+if [ -n "$cksum" ]
+then
+  verify_cksum $cksum $tmpltimg
+fi
+[ -n "$verbose" ] && is_compressed $tmpltimg
+tmpltimg2=$(uncompress $tmpltimg)
+rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n"
+
+tmpltimg2=$(untar $tmpltimg2)
+rollback_if_needed $tmpltfs $? "tar archives not supported\n"
+
+if [ ${tmpltname%.vhd} != ${tmpltname} ]
+then
+  if [ $(isCifs) -ne 0 ] ;
+  then
+      if  which  vhd-util &>/dev/null
+      then
+        vhd-util read -p -n ${tmpltimg2} > /dev/null
+        rollback_if_needed $tmpltfs $? "vhd check of $tmpltimg2 failed\n"
+        vhd-util set -n ${tmpltimg2} -f "hidden" -v "0" > /dev/null
+        rollback_if_needed $tmpltfs $? "vhd remove $tmpltimg2 hidden failed\n"
+     fi
+  fi
+fi
+
+imgsize=$(ls -l $tmpltimg2| awk -F" " '{print $5}')
+
+create_from_file $tmpltfs $tmpltimg2 $tmpltname
+
+touch /$tmpltfs/template.properties
+rollback_if_needed $tmpltfs $? "Failed to create template.properties file"
+echo -n "" > /$tmpltfs/template.properties
+
+today=$(date '+%m_%d_%Y')
+echo "filename=$tmpltname" > /$tmpltfs/template.properties
+echo "description=$descr" >> /$tmpltfs/template.properties
+echo "checksum=$cksum" >> /$tmpltfs/template.properties
+echo "hvm=$hvm" >> /$tmpltfs/template.properties
+echo "size=$imgsize" >> /$tmpltfs/template.properties
+
+if [ "$cleanup" == "true" ]
+then
+  rm -f $tmpltimg
+fi
+
+exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/metadata.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/metadata.rb b/tools/devcloud4/common/development-installation/metadata.rb
new file mode 100644
index 0000000..c240755
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/metadata.rb
@@ -0,0 +1,42 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+name 'development-installation'
+maintainer 'Ian Duffy'
+maintainer_email 'ian@ianduffy.ie'
+license 'Apache 2'
+description 'Wrapper around several different cookbooks.'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version '0.1.0'
+
+depends 'mysql', '= 5.6.1'
+depends 'cloudstack', '>= 3.0.0'
+depends 'nfs', '>= 2.0.0'
+
+supports 'centos'
+supports 'redhat'
+supports 'debian'
+supports 'ubuntu'
+supports 'fedora'
+supports 'oracle'
+
+provides 'development-installation::default'
+provides 'development-installation::database_server'
+provides 'development-installation::nfs_server'
+provides 'development-installation::system_templates.rb'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/recipes/database_server.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/recipes/database_server.rb b/tools/devcloud4/common/development-installation/recipes/database_server.rb
new file mode 100644
index 0000000..28a374c
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/recipes/database_server.rb
@@ -0,0 +1,24 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+include_recipe 'mysql::server'
+include_recipe 'mysql::client'
+
+include_recipe 'cloudstack::mysql_conf'
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/recipes/default.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/recipes/default.rb b/tools/devcloud4/common/development-installation/recipes/default.rb
new file mode 100644
index 0000000..617acc7
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/recipes/default.rb
@@ -0,0 +1,27 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+service 'iptables' do
+  action [:disable, :stop]
+  only_if { platform?(%w{redhat centos fedora oracle}) }
+end
+
+include_recipe 'development-installation::nfsshares'
+include_recipe 'development-installation::system_templates'
+include_recipe 'development-installation::database_server'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/recipes/nfsshares.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/recipes/nfsshares.rb b/tools/devcloud4/common/development-installation/recipes/nfsshares.rb
new file mode 100644
index 0000000..100eab9
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/recipes/nfsshares.rb
@@ -0,0 +1,48 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+include_recipe 'nfs::server'
+
+directory node['cloudstack']['secondary']['path'] do
+  owner 'root'
+  group 'root'
+  action :create
+  recursive true
+end
+
+nfs_export node['cloudstack']['secondary']['path'] do
+  network '*'
+  writeable true
+  sync false
+  options %w(no_root_squash no_subtree_check)
+end
+
+directory node['cloudstack']['primary']['path'] do
+  owner 'root'
+  group 'root'
+  action :create
+  recursive true
+end
+
+nfs_export node['cloudstack']['primary']['path'] do
+  network '*'
+  writeable true
+  sync false
+  options %w(no_root_squash no_subtree_check)
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/common/development-installation/recipes/system_templates.rb
----------------------------------------------------------------------
diff --git a/tools/devcloud4/common/development-installation/recipes/system_templates.rb b/tools/devcloud4/common/development-installation/recipes/system_templates.rb
new file mode 100644
index 0000000..7723f26
--- /dev/null
+++ b/tools/devcloud4/common/development-installation/recipes/system_templates.rb
@@ -0,0 +1,38 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+cookbook_file 'cloud-install-sys-tmplt' do
+  action :create_if_missing
+  mode 0755
+  path node['cloudstack']['cloud-install-sys-tmplt']
+end
+
+cookbook_file 'createtmplt.sh' do
+  action :create_if_missing
+  mode 0755
+  path node['cloudstack']['createtmplt']
+end
+
+cloudstack_system_template 'xenserver' do
+  template_id '1'
+  nfs_path node['cloudstack']['secondary']['path']
+  nfs_server node['cloudstack']['secondary']['host']
+  url node['cloudstack']['hypervisor_tpl']['xenserver']
+  action :create
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/pom.xml
----------------------------------------------------------------------
diff --git a/tools/devcloud4/pom.xml b/tools/devcloud4/pom.xml
new file mode 100644
index 0000000..6b1a84f
--- /dev/null
+++ b/tools/devcloud4/pom.xml
@@ -0,0 +1,112 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  you under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-devcloud4</artifactId>
+  <name>Apache CloudStack DevCloud4</name>
+  <packaging>pom</packaging>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloud-tools</artifactId>
+    <version>4.6.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-developer</artifactId>
+      <version>${project.version}</version>
+      <type>pom</type>
+      <optional>true</optional>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+  </build>
+  <profiles>
+    <profile>
+      <id>deploydb</id>
+      <activation>
+        <property>
+          <name>deploydb</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>properties-maven-plugin</artifactId>
+            <version>1.0-alpha-2</version>
+            <executions>
+              <execution>
+                <phase>initialize</phase>
+                <goals>
+                  <goal>read-project-properties</goal>
+                </goals>
+                <configuration>
+                  <files>
+                    <file>${project.parent.parent.basedir}/utils/conf/db.properties</file>
+                    <file>${project.parent.parent.basedir}/utils/conf/db.properties.override</file>
+                  </files>
+                  <quiet>true</quiet>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>sql-maven-plugin</artifactId>
+            <version>1.5</version>
+            <dependencies>
+              <!-- specify the dependent jdbc driver here -->
+              <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${cs.mysql.version}</version>
+              </dependency>
+            </dependencies>
+            <configuration>
+              <driver>org.gjt.mm.mysql.Driver</driver>
+              <url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
+              <username>${db.cloud.username}</username>
+              <password>${db.cloud.password}</password>
+              <!--all executions are ignored if -Dmaven.test.skip=true -->
+              <skip>${maven.test.skip}</skip>
+              <forceMojoExecution>true</forceMojoExecution>
+            </configuration>
+            <executions>
+              <execution>
+                <id>create-schema</id>
+                <phase>process-resources</phase>
+                <goals>
+                  <goal>execute</goal>
+                </goals>
+                <configuration>
+                  <srcFiles>
+                    <srcFile>${basedir}/prefill.sql</srcFile>
+                  </srcFiles>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/devcloud4/prefill.sql
----------------------------------------------------------------------
diff --git a/tools/devcloud4/prefill.sql b/tools/devcloud4/prefill.sql
new file mode 100644
index 0000000..d06de50
--- /dev/null
+++ b/tools/devcloud4/prefill.sql
@@ -0,0 +1,34 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+-- 
+--   http://www.apache.org/licenses/LICENSE-2.0
+-- 
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+REPLACE INTO `cloud`.`disk_offering` (id, name, uuid, display_text, created, use_local_storage, type, disk_size) VALUES (17, 'Devcloud4 offering', UUID(), 'Devcloud4 offering', NOW(), 1, 'Service', 0);
+REPLACE INTO `cloud`.`service_offering` (id, cpu, speed, ram_size) VALUES (17, 1, 200, 256);
+REPLACE INTO `cloud`.`disk_offering` (name, uuid, display_text, created, use_local_storage, type, disk_size) VALUES ('Devcloud4 disk offering', UUID(), 'Devcloud4 disk offering', NOW(), 1, 'Disk', 1073741824);
+REPLACE INTO `cloud`.`configuration` (category, instance, component, name, value) VALUES ('Advanced', 'DEFAULT', 'management-server', 'integration.api.port', '8096');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.ram.size', '256');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.cpu.mhz','256');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.ram.size','256');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.cpu.mhz', '256');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.ram.size','256');
+REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.cpu.mhz','256');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'system.vm.use.local.storage', 'true');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.workers', '3');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.delay', '60');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.interval', '60');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'management.network.cidr', '0.0.0.0/0');
+REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'secstorage.allowed.internal.sites', '0.0.0.0/0');
+UPDATE `cloud`.`vm_template` SET unique_name="Macchinina",name="Macchinina",url="http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",checksum="30985504bc31bf0cd3b9d2c6ca7944d3",display_text="Macchinina" where id=5;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66cded75/tools/pom.xml
----------------------------------------------------------------------
diff --git a/tools/pom.xml b/tools/pom.xml
index ed2d806..1885b9d 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -37,6 +37,7 @@
         <module>apidoc</module>
         <module>marvin</module>
         <module>devcloud</module>
-        <module>devcloud-kvm</module>
+        <module>devcloud4</module>
+	<module>devcloud-kvm</module>
     </modules>
 </project>