Cisco Cisco Evolved Programmable Network Manager 2.0 Developer's Guide

Page of 204
  
 
 
 
Cisco Evolved Programmable Network Manager 2.0.1 RESTCONF API Guide 
 
 
200 
8.7  High-Availability Notifications 
HA notifications are sent for: 
 
Failover: when the secondary becomes active 
 
Failback: when the primary becomes active again. 
8.7.1  Sample HA Notifications 
8.7.1.1  Failover 
 
 
<?
xml
 
version
=
"1.0"
 
encoding
=
"UTF-8"
 
standalone
=
"yes"
?>
 
<
ns1:push-change-update
 
xmlns:ns1
=
"urn:cisco:params:xml:ns:yang:yang-push:v1"
>
 
    
<
ns1:topic
>
ha
</
ns1:topic
>
 
    
<
ns1:time-of-update
>
Thu Jun 23 05:31:50 UTC 2016
</
ns1:time-of-update
>
 
    
<
ns1:operation
>
ns14:ha
</
ns1:operation
>
 
    
<
ns1:ha-notification
>
 
        
<
ns1:operation-type
>
failover
</
ns1:operation-type
>
 
        
<
ns1:host
>
epnm-secondary
</
ns1:host
>
 
        
<
ns1:message
>
The Cisco EPN-M server at epnm-secondary is now ONLINE
</
ns1:message
>
 
    
</
ns1:ha-notification
>
 
</
ns1:push-change-update
 
8.7.1.2  Failback 
 
 
<?
xml
 
version
=
"1.0"
 
encoding
=
"UTF-8"
 
standalone
=
"yes"
?>
 
<
ns1:push-change-update
 
xmlns:ns1
=
"urn:cisco:params:xml:ns:yang:yang-push:v1"
>
 
    
<
ns1:topic
>
ha
</
ns1:topic
>
 
    
<
ns1:time-of-update
>
Thu Jun 24 05:31:50 UTC 2016
</
ns1:time-of-update
>
 
    
<
ns1:operation
>
ns14:ha
</
ns1:operation
>
 
    
<
ns1:ha-notification
>
 
        
<
ns1:operation-type
>
failback
</
ns1:operation-type
>
 
        
<
ns1:host
>
epnm-primary
</
ns1:host
>
 
        
<
ns1:message
>
The Cisco EPN-M server at epnm-primary is now ONLINE
</
ns1:message
>
 
    
</
ns1:ha-notification
>
 
</
ns1:push-change-update
 
 
8.8  Notifications Client 
 
The notifications client that is supported by EPN-M restconf should ideally be supporting 
web-sockets. The recommendation is to use a client that works with "Atmosphere 
framework". 
8.8.1  Sample client code 
 
import
 java.util.Scanner; 
import
 org.atmosphere.wasync.ClientFactory; 
import
 org.atmosphere.wasync.Event; 
import
 org.atmosphere.wasync.Function; 
import
 org.atmosphere.wasync.Request; 
import
 org.atmosphere.wasync.RequestBuilder; 
import
 org.atmosphere.wasync.Socket; 
import
 org.atmosphere.wasync.impl.AtmosphereClient;