← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1477570] [NEW] VPNaaS: StrongSwanProcess changes DIALECT_MAP from base class at init

 

Public bug reported:

__init__ method of StrongSwanProcess [1] changes the DIALECT_MAP the
following way:

    def __init__(self, conf, process_id, vpnservice, namespace):
        self.DIALECT_MAP['v1'] = 'ikev1'
        self.DIALECT_MAP['v2'] = 'ikev2'
        super(StrongSwanProcess, self).__init__(conf, process_id,
                                                vpnservice, namespace)

DIALECT_MAP is a class variable of BaseSwanProcess  which is a base
class for StrongSwanProcess and OpenSwanProcess [2]. Overwriting class
variables at instance init is not safe and it leads to sideefects, i.e.
when running UTs for both StrongSwanProcess and OpenSwanProcess.

DIALECT_MAP should be instead be redefined in StrongSwanProcess class
namespace.

[1] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py#L61
[2] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/ipsec.py#L89

** Affects: neutron
     Importance: Undecided
     Assignee: Elena Ezhova (eezhova)
         Status: New


** Tags: vpnaas

** Tags added: vpnaas

** Changed in: neutron
     Assignee: (unassigned) => Elena Ezhova (eezhova)

** Description changed:

  __init__ method of StrongSwanProcess [1] changes the DIALECT_MAP the
  following way:
  
-     def __init__(self, conf, process_id, vpnservice, namespace):
-         self.DIALECT_MAP['v1'] = 'ikev1'
-         self.DIALECT_MAP['v2'] = 'ikev2'
-         super(StrongSwanProcess, self).__init__(conf, process_id,
-                                                 vpnservice, namespace)
+     def __init__(self, conf, process_id, vpnservice, namespace):
+         self.DIALECT_MAP['v1'] = 'ikev1'
+         self.DIALECT_MAP['v2'] = 'ikev2'
+         super(StrongSwanProcess, self).__init__(conf, process_id,
+                                                 vpnservice, namespace)
  
  DIALECT_MAP is a class variable of BaseSwanProcess  which is a base
- class for StrongSwanProcess and OpenSwanProcess. Overwriting class
+ class for StrongSwanProcess and OpenSwanProcess [2]. Overwriting class
  variables at instance init is not safe and it leads to sideefects, i.e.
  when running UTs for both StrongSwanProcess and OpenSwanProcess.
  
  DIALECT_MAP should be instead be redefined in StrongSwanProcess class
  namespace.
  
- [1] https://github.com/openstack/neutron-
- vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py#L61
+ [1] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py#L61
+ [2] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/ipsec.py#L89

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1477570

Title:
  VPNaaS: StrongSwanProcess changes DIALECT_MAP from base class at init

Status in neutron:
  New

Bug description:
  __init__ method of StrongSwanProcess [1] changes the DIALECT_MAP the
  following way:

      def __init__(self, conf, process_id, vpnservice, namespace):
          self.DIALECT_MAP['v1'] = 'ikev1'
          self.DIALECT_MAP['v2'] = 'ikev2'
          super(StrongSwanProcess, self).__init__(conf, process_id,
                                                  vpnservice, namespace)

  DIALECT_MAP is a class variable of BaseSwanProcess  which is a base
  class for StrongSwanProcess and OpenSwanProcess [2]. Overwriting class
  variables at instance init is not safe and it leads to sideefects,
  i.e. when running UTs for both StrongSwanProcess and OpenSwanProcess.

  DIALECT_MAP should be instead be redefined in StrongSwanProcess class
  namespace.

  [1] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py#L61
  [2] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/ipsec.py#L89

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1477570/+subscriptions


Follow ups