From: Sumit Naiksatam Date: Fri, 5 Aug 2011 19:45:28 +0000 (-0700) Subject: Fixed issue with creating new port profiles (one configuration parameter got left... X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c5bc02a04b99c093fcd7a76bc19dabd19a356ffb;p=openstack-build%2Fneutron-build.git Fixed issue with creating new port profiles (one configuration parameter got left out during the migration to the new configuration scheme). Also fixed a bug in the calculation of the profile id. --- diff --git a/quantum/plugins/cisco/conf/l2network_plugin.ini b/quantum/plugins/cisco/conf/l2network_plugin.ini index f6ac8613b..5a0d7d7a9 100644 --- a/quantum/plugins/cisco/conf/l2network_plugin.ini +++ b/quantum/plugins/cisco/conf/l2network_plugin.ini @@ -1,5 +1,4 @@ [VLANS] -#Change the following to reflect the VLAN range in your system vlan_start=100 vlan_end=3000 vlan_name_prefix=q- @@ -7,5 +6,8 @@ vlan_name_prefix=q- [PORTS] max_ports=100 +[PORTPROFILES] +max_port_profiles=65568 + [NETWORKS] max_networks=65568 diff --git a/quantum/plugins/cisco/l2network_plugin.py b/quantum/plugins/cisco/l2network_plugin.py index b9ada4d5f..e3642515c 100644 --- a/quantum/plugins/cisco/l2network_plugin.py +++ b/quantum/plugins/cisco/l2network_plugin.py @@ -375,10 +375,23 @@ class L2Network(object): self._portprofile_counter += 1 self._portprofile_counter %= int(conf.MAX_PORT_PROFILES) id = tenant_id[:3] + "-pp-" + \ - ("0" * (6 - len(str(self._net_counter)))) + str(self._net_counter) + ("0" * (6 - len(str(self._net_counter)))) \ + + str(self._portprofile_counter) # TODO (Sumit): Need to check if the ID has already been allocated # ID will be generated by DB return id -# TODO (Sumit): - # (1) Persistent storage + +def main(): + client = L2Network() + client.create_portprofile("12345", "tpp1", "2") + client.create_portprofile("12345", "tpp2", "3") + print ("%s\n") % client.get_all_portprofiles("12345") + +if __name__ == '__main__': + main() + +""" +TODO (Sumit): +(1) Persistent storage +""" diff --git a/quantum/plugins/cisco/l2network_plugin_configuration.py b/quantum/plugins/cisco/l2network_plugin_configuration.py index e0fe786a5..fe619ddfc 100644 --- a/quantum/plugins/cisco/l2network_plugin_configuration.py +++ b/quantum/plugins/cisco/l2network_plugin_configuration.py @@ -34,6 +34,9 @@ VLAN_END = section['vlan_end'] section = cp['PORTS'] MAX_PORTS = section['max_ports'] +section = cp['PORTPROFILES'] +MAX_PORT_PROFILES = section['max_port_profiles'] + section = cp['NETWORKS'] MAX_NETWORKS = section['max_networks']