Hi,

Please find the cartridge-agent patch implemented by Chamils for this
corresponding changes.

Thanks.

On Sat, Dec 13, 2014 at 9:37 PM, Rajkumar Rajaratnam <rajkum...@wso2.com>
wrote:

> Hi,
>
> Did anyone get a chance to commit this changes?
>
> Thanks.
>
> On Fri, Dec 5, 2014 at 7:46 PM, Rajkumar Rajaratnam <rajkum...@wso2.com>
> wrote:
>>
>> Hi,
>>
>> I am attaching the patch for topology changes.
>>
>> @Chamila,
>>
>> Please do the changes in python agent accordingly. Basic idea is that
>> topology and topology events are carrying
>>
>>    - list of private IPs
>>    - list of public IPs
>>    - a default public IP (for LB routing)
>>    - a default private IP (for LB routing)
>>
>> Thanks.
>>
>> On Fri, Dec 5, 2014 at 10:59 AM, Reka Thirunavukkarasu <r...@wso2.com>
>> wrote:
>>
>>> HI Raj,
>>>
>>> On Fri, Dec 5, 2014 at 8:20 AM, Rajkumar Rajaratnam <rajkum...@wso2.com>
>>> wrote:
>>>
>>>> Okay.
>>>>
>>>> @Reka, Please let me know when are done with testing.
>>>>
>>>
>>> Sure..We are in the process of stabilising grouping feature in the
>>> master. Will update once we have the complete flow working fine..
>>>
>>>>
>>>> I will make a diff in meantime.
>>>>
>>>
>>> +1. Anyway, you might need to rebase it when you apply it as we are also
>>> fixing bugs in the same code..
>>>
>>> Thanks,
>>> Reka
>>>
>>>>
>>>> Thanks.
>>>>
>>>> On Fri, Dec 5, 2014 at 8:08 AM, Lakmal Warusawithana <lak...@wso2.com>
>>>> wrote:
>>>>
>>>>> Sure, shall we do this after complete full work flow test in grouping.
>>>>>
>>>>> On Fri, Dec 5, 2014 at 8:00 AM, Rajkumar Rajaratnam <
>>>>> rajkum...@wso2.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Please let me know the decision on this before code freeze. This is a
>>>>>> simple change to do.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Fri, Dec 5, 2014 at 1:41 AM, Rajkumar Rajaratnam <
>>>>>> rajkum...@wso2.com> wrote:
>>>>>>
>>>>>>> Hi Devs,
>>>>>>>
>>>>>>> I have integrated multiple network interfaces support into the
>>>>>>> master branch and it is working fine.
>>>>>>>
>>>>>>> Now we should modify the topology to include list of private/public
>>>>>>> IP addresses. Currently topology and topology events supports max of one
>>>>>>> public IP and one private IP.
>>>>>>>
>>>>>>> Can I go ahead and do this change?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> --
>>>>>>> Rajkumar Rajaratnam
>>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>> Software Engineer, WSO2
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Rajkumar Rajaratnam
>>>>>> Committer & PMC Member, Apache Stratos
>>>>>> Software Engineer, WSO2
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lakmal Warusawithana
>>>>> Vice President, Apache Stratos
>>>>> Director - Cloud Architecture; WSO2 Inc.
>>>>> Mobile : +94714289692
>>>>> Blog : http://lakmalsview.blogspot.com/
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Rajkumar Rajaratnam
>>>> Committer & PMC Member, Apache Stratos
>>>> Software Engineer, WSO2
>>>>
>>>
>>>
>>>
>>> --
>>> Reka Thirunavukkarasu
>>> Senior Software Engineer,
>>> WSO2, Inc.:http://wso2.com,
>>> Mobile: +94776442007
>>>
>>>
>>>
>>
>>
>> --
>> Rajkumar Rajaratnam
>> Committer & PMC Member, Apache Stratos
>> Software Engineer, WSO2
>>
>
>
> --
> Rajkumar Rajaratnam
> Committer & PMC Member, Apache Stratos
> Software Engineer, WSO2
>



-- 
Rajkumar Rajaratnam
Committer & PMC Member, Apache Stratos
Software Engineer, WSO2

Mobile : +94777568639
Blog : rajkumarr.com
Index: components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/topology/events.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/topology/events.py	(revision 3309e9998b61fef24278a7a17046399d263f766a)
+++ components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/topology/events.py	(revision )
@@ -35,7 +35,7 @@
         """ :type : str  """
         self.port_map = {}
         """ :type : dict[str, Port]  """
-        self.member_ip = None
+        self.member_private_ips = None
         """ :type : str  """
 
     def get_port(self, proxy_port):
@@ -61,7 +61,10 @@
         instance.partition_id = json_obj["partitionId"] if "partitionId" in json_obj else None
         instance.member_id = json_obj["memberId"] if "memberId" in json_obj else None
         #instance.port_map = json_obj["portMap"] if "portMap" in json_obj else {}
-        instance.member_ip = json_obj["memberIp"] if "memberIp" in json_obj else None
+        instance.member_private_ips = json_obj["memberPrivateIps"] if "memberPrivateIps" in json_obj else None
+        instance.member_public_ips = json_obj["memberPublicIPs"] if "memberPublicIPs" in json_obj else None
+        instance.member_default_public_ip = json_obj["defaultPublicIP"] if "defaultPublicIP" in json_obj else None
+        instance.member_default_private_ip = json_obj["defaultPrivateIP"] if "defaultPrivateIP" in json_obj else None
 
         for port_proxy in json_obj["portMap"]:
             port_str = json_obj["portMap"][port_proxy]
@@ -185,9 +188,9 @@
                         mm_partition_id = member_str["partitionId"] if "partitionId" in member_str else None
 
                         member_obj = Member(mm_service_name, mm_cluster_id, mm_network_partition_id, mm_partition_id, member_id)
-                        member_obj.member_public_ip = member_str["memberPublicIp"] if "memberPublicIp" in member_str else None
+                        member_obj.member_public_ips = member_str["memberPublicIps"] if "memberPublicIps" in member_str else None
                         member_obj.status = member_str["status"] if "status" in member_str else None
-                        member_obj.member_ip = member_str["memberIp"]
+                        member_obj.member_private_ips = member_str["memberPrivateIps"]
                         member_obj.properties = member_str["properties"]
                         member_obj.lb_cluster_id = member_str["lbClusterId"] if "lbClusterId" in member_str else None
                         member_obj.json_str = member_str
@@ -256,9 +259,9 @@
         """ :type : str  """
         self.lb_cluster_id = None
         """ :type : str  """
-        self.member_public_ip = None
+        self.member_public_ips = None
         """ :type : str  """
-        self.member_ip = None
+        self.member_private_ips = None
         """ :type : str  """
         self.properties = {}
         """ :type : dict[str, str]  """
@@ -274,8 +277,10 @@
         instance.partition_id = json_obj["partitionId"] if "partitionId" in json_obj else None
         instance.member_id = json_obj["memberId"] if "memberId" in json_obj else None
         instance.lb_cluster_id = json_obj["lbClusterId"] if "lbClusterId" in json_obj else None
-        instance.member_public_ip = json_obj["memberPublicIp"] if "memberPublicIp" in json_obj else None
-        instance.member_ip = json_obj["memberIp"] if "memberIp" in json_obj else None
+        instance.member_private_ips = json_obj["memberPrivateIps"] if "memberPrivateIps" in json_obj else None
+        instance.member_public_ips = json_obj["memberPublicIPs"] if "memberPublicIPs" in json_obj else None
+        instance.member_default_public_ip = json_obj["defaultPublicIP"] if "defaultPublicIP" in json_obj else None
+        instance.member_default_private_ip = json_obj["defaultPrivateIP"] if "defaultPrivateIP" in json_obj else None
         instance.properties = json_obj["properties"]
 
         return instance
\ No newline at end of file
Index: components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/topology/topologycontext.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/topology/topologycontext.py	(revision 3309e9998b61fef24278a7a17046399d263f766a)
+++ components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/topology/topologycontext.py	(revision )
@@ -337,12 +337,16 @@
         self.port_map = {}
         """ :type : dict[str, Port]  """
 
-        self.member_public_ip = None
+        self.member_public_ips = None
         """ :type : str  """
+        self.member_default_public_ip = None
+        """ :type : str """
         self.status = None
         """ :type : str  """
-        self.member_ip = None
+        self.member_private_ips = None
+        """ :type : str  """
+        self.member_default_private_ip = None
-        """ :type : str  """
+        """ :type : str """
         self.properties = {}
         """ :type : dict[str, str]  """
         self.lb_cluster_id = None
\ No newline at end of file
Index: components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/extensions/defaultextensionhandler.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/extensions/defaultextensionhandler.py	(revision 3309e9998b61fef24278a7a17046399d263f766a)
+++ components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/extensions/defaultextensionhandler.py	(revision )
@@ -153,7 +153,7 @@
         if extensionutils.is_relevant_member_event(member_activated_event.service_name,
                                                    member_activated_event.cluster_id, lb_cluster_id):
 
-            env_params = {"STRATOS_MEMBER_ACTIVATED_MEMBER_IP": str(member_activated_event.member_ip),
+            env_params = {"STRATOS_MEMBER_ACTIVATED_MEMBER_IP": str(member_activated_event.member_default_private_ip),
                           "STRATOS_MEMBER_ACTIVATED_MEMBER_ID": str(member_activated_event.member_id),
                           "STRATOS_MEMBER_ACTIVATED_CLUSTER_ID": str(member_activated_event.cluster_id),
                           "STRATOS_MEMBER_ACTIVATED_LB_CLUSTER_ID": str(lb_cluster_id),
@@ -190,7 +190,7 @@
 
                 has_wk_ip_changed = True
                 for wk_member in self.wk_members:
-                    if wk_member.member_ip == member_activated_event.member_ip:
+                    if wk_member.member_default_private_ip == member_activated_event.member_default_private_ip:
                         has_wk_ip_changed = False
 
                 self.log.debug(" hasWKIpChanged %r" + has_wk_ip_changed)
@@ -291,7 +291,7 @@
                 member_terminated_event.cluster_id,
                 lb_cluster_id):
 
-            env_params = {"STRATOS_MEMBER_TERMINATED_MEMBER_IP": terminated_member.member_ip,
+            env_params = {"STRATOS_MEMBER_TERMINATED_MEMBER_IP": terminated_member.member_default_private_ip,
                           "STRATOS_MEMBER_TERMINATED_MEMBER_ID": member_terminated_event.member_id,
                           "STRATOS_MEMBER_TERMINATED_CLUSTER_ID": member_terminated_event.cluster_id,
                           "STRATOS_MEMBER_TERMINATED_LB_CLUSTER_ID": lb_cluster_id,
@@ -340,7 +340,7 @@
                 member_suspended_event.cluster_id,
                 lb_cluster_id):
 
-            env_params = {"STRATOS_MEMBER_SUSPENDED_MEMBER_IP": member_suspended_event.member_ip,
+            env_params = {"STRATOS_MEMBER_SUSPENDED_MEMBER_IP": member_suspended_event.member_default_private_ip,
                           "STRATOS_MEMBER_SUSPENDED_MEMBER_ID": member_suspended_event.member_id,
                           "STRATOS_MEMBER_SUSPENDED_CLUSTER_ID": member_suspended_event.cluster_id,
                           "STRATOS_MEMBER_SUSPENDED_LB_CLUSTER_ID": lb_cluster_id,
@@ -389,7 +389,7 @@
                 member_started_event.cluster_id,
                 lb_cluster_id):
 
-            env_params = {"STRATOS_MEMBER_STARTED_MEMBER_IP": started_member.member_ip,
+            env_params = {"STRATOS_MEMBER_STARTED_MEMBER_IP": started_member.member_default_private_ip,
                           "STRATOS_MEMBER_STARTED_MEMBER_ID": member_started_event.member_id,
                           "STRATOS_MEMBER_STARTED_CLUSTER_ID": member_started_event.cluster_id,
                           "STRATOS_MEMBER_STARTED_LB_CLUSTER_ID": lb_cluster_id,
@@ -554,8 +554,8 @@
                     return False
 
                 apistore_member = apistore_member_list[0]
-                env_params["STRATOS_WK_APISTORE_MEMBER_IP"] = apistore_member.member_ip
-                self.log.debug("STRATOS_WK_APISTORE_MEMBER_IP: %r" % apistore_member.member_ip)
+                env_params["STRATOS_WK_APISTORE_MEMBER_IP"] = apistore_member.member_default_private_ip
+                self.log.debug("STRATOS_WK_APISTORE_MEMBER_IP: %r" % apistore_member.member_default_private_ip)
 
                 publisher_member_list = []
                 for member in publisher_cluster_collection[0].get_members():
@@ -567,8 +567,8 @@
                     self.log.debug("API Publisher members not yet created")
 
                 publisher_member = publisher_member_list[0]
-                env_params["STRATOS_WK_PUBLISHER_MEMBER_IP"] = publisher_member.member_ip
-                self.log.debug("STRATOS_WK_PUBLISHER_MEMBER_IP: %r" % publisher_member.member_ip)
+                env_params["STRATOS_WK_PUBLISHER_MEMBER_IP"] = publisher_member.member_default_private_ip
+                self.log.debug("STRATOS_WK_PUBLISHER_MEMBER_IP: %r" % publisher_member.member_default_private_ip)
 
                 return True
 
@@ -613,13 +613,13 @@
 
                     wk_members.append(member)
                     self.wk_members.append(member)
-                    self.log.debug("Found WKA: STRATOS_WK_MEMBER_IP: " + member.member_ip)
+                    self.log.debug("Found WKA: STRATOS_WK_MEMBER_IP: " + member.member_default_private_ip)
 
             if len(wk_members) >= min_count:
                 idx = 0
                 for member in wk_members:
-                    env_params["STRATOS_WK_MEMBER_" + idx + "_IP"] = member.member_ip
-                    self.log.debug("STRATOS_WK_MEMBER_" + idx + "_IP:" + member.member_ip)
+                    env_params["STRATOS_WK_MEMBER_" + idx + "_IP"] = member.member_default_private_ip
+                    self.log.debug("STRATOS_WK_MEMBER_" + idx + "_IP:" + member.member_default_private_ip)
 
                     idx += 1
 
@@ -687,8 +687,8 @@
             min_manager_instances_available = True
             idx = 0
             for member in manager_wka_members:
-                env_params["STRATOS_WK_MANAGER_MEMBER_" + idx + "_IP"] = member.member_ip
-                self.log.debug("STRATOS_WK_MANAGER_MEMBER_" + idx + "_IP: " + member.member_ip)
+                env_params["STRATOS_WK_MANAGER_MEMBER_" + idx + "_IP"] = member.member_default_private_ip
+                self.log.debug("STRATOS_WK_MANAGER_MEMBER_" + idx + "_IP: " + member.member_default_private_ip)
                 idx += 1
 
             env_params["STRATOS_WK_MANAGER_MEMBER_COUNT"] = int(manager_min_instance_count)
@@ -748,8 +748,8 @@
             min_worker_instances_available = True
             idx = 0
             for member in worker_wka_members:
-                env_params["STRATOS_WK_WORKER_MEMBER_" + idx + "_IP"] = member.member_ip
-                self.log.debug("STRATOS_WK_WORKER_MEMBER_" + idx + "_IP: " + member.member_ip)
+                env_params["STRATOS_WK_WORKER_MEMBER_" + idx + "_IP"] = member.member_default_private_ip
+                self.log.debug("STRATOS_WK_WORKER_MEMBER_" + idx + "_IP: " + member.member_default_private_ip)
                 idx += 1
 
             env_params["STRATOS_WK_WORKER_MEMBER_COUNT"] = int(worker_min_instance_count)
\ No newline at end of file
Index: components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/util/extensionutils.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/util/extensionutils.py	(revision 3309e9998b61fef24278a7a17046399d263f766a)
+++ components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/util/extensionutils.py	(revision )
@@ -463,7 +463,7 @@
             members = cluster.get_members()
             for member in members:
                 if member.cluster_id == lb_cluster_id:
-                    return [member.member_ip, member.member_public_ip]
+                    return [member.member_default_private_ip, member.member_default_public_ip]
 
     return None
 
\ No newline at end of file

Reply via email to