Custom Search
Showing posts with label XMPP. Show all posts
Showing posts with label XMPP. Show all posts

Wednesday, May 20, 2015

OpenContrail XMPP Message

1)
* 5269 : XMPP Server Port (Control Node)

2)
iq - messages

================

a)
Similar to http GET and POST

Example of request "iq" message:
---------------------------------

<iq
    to='book.lit'
    type='get'
    id='disco:l'>    

    <query xmlns='disco#info'/>

</iq>



* type='get' is equal to http GET
* type='set' is equal to http POST

* Every "iq" message has "id" and that should be unique.
* Request "iq" message and response "iq" message will contain same "id", so it can track correct response message.
* Here "<query xmlns='disco#info'/>" is the child tag, which tell which extension protocol is using.
* Here "query" tag contains, what is requesting.
* Here the namespace "xmlns='disco#info'" means that it uses service discovery extension protocol.

Example of response "iq" message:
----------------------------------

<iq
    to='romeo@book.lit/home'
    from='book.lit'
    type='result'
    id='disco:l'
    <query xmlns='disco#info'>
        <identity category='server'
        type='im'
        name='ejabberd'/>
        <feature var='vard-temp'/>
    </query>
</iq>



* "type='result'" indicate that it is a response.
* Here "id='disco:l'" match with "id" in the request "iq" message
* Here "query" tag contains the result or response of the request.
* "<identity .... />" is the service discovery result or response message.


3)
Long polling
-------------

* Bidirectional Streams Over Synchronous Http (BOSH) - Long polling

* Difference Long polling and Normal polling

- Normal polling:
    * client send request to Server and Server reply immediatly (with result or without result). Client repeat this after a specific interval.

- Long polling:
    * client send request to Server and that request wait (long time/specific time) in server side until something new comes in the server and server reply when something new comes. So here request is waiting in server for log time for the response. Here client should wait long time for the response and send new request after a specific time, if there is no response, that time server will discard the previous request.


4)
set/post "iq" request to "config" to subscribe on node "virtual-machine:3654ee7d-02d6-4a16-b526-304d559488a7"
---------------------------------------------------

<?xml version="1.0"?>


<iq type="set"
     from="ubuntu"
     to="network-control@contrailsystems.com/config">


    <pubsub xmlns="http://jabber.org/protocol/pubsub">


        <subscribe node="virtual-machine:3654ee7d-02d6-4a16-b526-304d559488a7"/>


    </pubsub>


</iq>


5)
set/post "iq" request to "bgp-peer" to subscribe on node "default-domain:demo:mynw1:mynw1"
--------------------------------------------------------------------

<?xml version="1.0"?>


<iq type="set"
     from="ubuntu"
     to="network-control@contrailsystems.com/bgp-peer"
     id="subscribe4">
    
    
    <pubsub xmlns="http://jabber.org/protocol/pubsub">
        
        
        <subscribe node="default-domain:demo:mynw1:mynw1">
            
            
            <options>
                
                
                <instance-id>
                    3
                </instance-id>
                
                
            </options>
            
            
        </subscribe>
        
        
    </pubsub>
    
    
</iq>



6)
set/post "iq" request to "config" for update
---------------------------------------------

* It update 'routing-instance' 'default-domain:demo:mynw1:mynw1'
* It update the link between 'instance-ip 1524eea3-e387-4f3f-aa8a-1dea528edf2f' and 'virtual-network default-domain:demo:mynw1'
* etc ---

<?xml version="1.0"?>


<iq type="set"
     from="network-control@contrailsystems.com"
     to="default-global-system-config:ubuntu/config">
    
        
    <config>
        
                
        <update>
            
                        
            <node type="routing-instance">
                
                                
                <name>
                    default-domain:demo:mynw1:mynw1
                </name>
                
                            
            </node>
            
                        
            <link>
                
                                
                <node type="virtual-machine-interface-routing-instance">
                    
                                        
                    <name>
                        attr(default-domain:demo:dbc7b522-dd36-44c3-ae91-c9f4a455ddff,default-domain:demo:mynw1:mynw1)
                    </name>
                    
                                    
                </node>
                
                                
                <node type="routing-instance">
                    
                                        
                    <name>
                        default-domain:demo:mynw1:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="virtual-machine-interface-routing-instance"/>
                
                            
            </link>
            
                        
            <link>
                
                                
                <node type="instance-ip">
                    
                                        
                    <name>
                        1524eea3-e387-4f3f-aa8a-1dea528edf2f
                    </name>
                    
                                    
                </node>
                
                                
                <node type="virtual-network">
                    
                                        
                    <name>
                        default-domain:demo:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="instance-ip-virtual-network"/>
                
                            
            </link>
            
                        
            <node type="virtual-network-network-ipam">
                
                                
                <name>
                    attr(default-domain:default-project:default-network-ipam,default-domain:demo:mynw1)
                </name>
                
                                
                <value>
                    
                                        
                    <ipam-subnets>
                        
                                                
                        <subnet>
                            
                                                        
                            <ip-prefix>
                                10.1.1.0
                            </ip-prefix>
                            
                                                        
                            <ip-prefix-len>
                                24
                            </ip-prefix-len>
                            
                                                    
                        </subnet>
                        
                                                
                        <default-gateway>
                            10.1.1.1
                        </default-gateway>
                        
                                                
                        <dns-server-address>
                        </dns-server-address>
                        
                                                
                        <subnet-uuid>
                            b77692a2-aea4-41fc-92de-28a9fa703f12
                        </subnet-uuid>
                        
                                                
                        <enable-dhcp>
                            true
                        </enable-dhcp>
                        
                                                
                        <addr_from_start>
                            true
                        </addr_from_start>
                        
                                                
                        <dhcp-option-list/>
                        
                                                
                        <host-routes/>
                        
                                                
                        <subnet-name>
                            subnet1
                        </subnet-name>
                        
                                            
                    </ipam-subnets>
                    
                                        
                    <host-routes/>
                    
                                    
                </value>
                
                            
            </node>
            
                        
            <link>
                
                                
                <node type="virtual-network">
                    
                                        
                    <name>
                        default-domain:demo:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <node type="virtual-network-network-ipam">
                    
                                        
                    <name>
                        attr(default-domain:default-project:default-network-ipam,default-domain:demo:mynw1)
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="virtual-network-network-ipam"/>
                
                            
            </link>
            
                        
            <link>
                
                                
                <node type="virtual-network">
                    
                                        
                    <name>
                        default-domain:demo:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <node type="routing-instance">
                    
                                        
                    <name>
                        default-domain:demo:mynw1:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="virtual-network-routing-instance"/>
                
                            
            </link>
            
                        
            <node type="network-ipam">
                
                                
                <name>
                    default-domain:default-project:default-network-ipam
                </name>
                
                                
                <id-perms>
                    
                                        
                    <permissions>
                        
                                                
                        <owner>
                            cloud-admin
                        </owner>
                        
                                                
                        <owner-access>
                            7
                        </owner-access>
                        
                                                
                        <group>
                            cloud-admin-group
                        </group>
                        
                                                
                        <group-access>
                            7
                        </group-access>
                        
                                                
                        <other-access>
                            7
                        </other-access>
                        
                                            
                    </permissions>
                    
                                        
                    <uuid>
                        
                                                
                        <uuid-mslong>
                            2800209106097422692
                        </uuid-mslong>
                        
                                                
                        <uuid-lslong>
                            11079038519831513023
                        </uuid-lslong>
                        
                                            
                    </uuid>
                    
                                        
                    <enable>
                        true
                    </enable>
                    
                                        
                    <created>
                        2015-02-12T11:50:12
                    </created>
                    
                                        
                    <last-modified>
                        2015-02-12T11:50:12
                    </last-modified>
                    
                                        
                    <description>
                    </description>
                    
                                        
                    <user-visible>
                        true
                    </user-visible>
                    
                                    
                </id-perms>
                
                            
            </node>
            
                        
            <link>
                
                                
                <node type="virtual-network-network-ipam">
                    
                                        
                    <name>
                        attr(default-domain:default-project:default-network-ipam,default-domain:demo:mynw1)
                    </name>
                    
                                    
                </node>
                
                                
                <node type="network-ipam">
                    
                                        
                    <name>
                        default-domain:default-project:default-network-ipam
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="virtual-network-network-ipam"/>
                
                            
            </link>
            
                    
        </update>
        
            
    </config>
    
    
</iq>



7)
set/post "iq" request to "config" for delete
---------------------------------------------

* It delete the link between 'instance-ip 1524eea3-e387-4f3f-aa8a-1dea528edf2f' and 'virtual-network default-domain:demo:mynw1'

<?xml version="1.0"?>


<iq type="set"
     from="network-control@contrailsystems.com"
     to="default-global-system-config:ubuntu/config">
    
        
    <config>
        
                
        <delete>
            
                        
            <link>
                
                                
                <node type="instance-ip">
                    
                                        
                    <name>
                        1524eea3-e387-4f3f-aa8a-1dea528edf2f
                    </name>
                    
                                    
                </node>
                
                                
                <node type="virtual-network">
                    
                                        
                    <name>
                        default-domain:demo:mynw1
                    </name>
                    
                                    
                </node>
                
                                
                <metadata type="instance-ip-virtual-network"/>
                
                            
            </link>
            
                    
        </delete>
        
            
    </config>
    
    
</iq>
















































Tuesday, May 19, 2015

OpenContrail Control Node XMPP Server and Port


1)
saju@ubuntu:~$ sudo netstat -tuplen | grep 5269
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      120        205565      31882/contrail-cont
saju@ubuntu:~$
saju@ubuntu:~$


2)
saju@ubuntu:~$ ps -aux | grep 31882
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
saju      2872  0.0  0.0   9392   932 pts/6    S+   20:33   0:00 grep --color=auto 31882
contrail 31882  0.0  0.1 229760  8688 ?        Sl   17:18   0:11 /usr/bin/contrail-control
saju@ubuntu:~$
saju@ubuntu:~$

3)
saju@ubuntu:~$ sudo netstat -tuplen | grep contrail-cont
tcp        0      0 0.0.0.0:8083            0.0.0.0:*               LISTEN      120        205567      31882/contrail-cont
tcp        0      0 0.0.0.0:179             0.0.0.0:*               LISTEN      120        205563      31882/contrail-cont
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      120        205565      31882/contrail-cont
saju@ubuntu:~$
saju@ubuntu:~$ 


Ports: 
a) 179 : BGP
b) 5269 : XMPP server for vRouter agent to connect to
c) 8083 : introspect for debugging