aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 45d85768a46e30f1f14bd15ce067caf78a6cfbef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# AVCN Simulator
Simulator that fetches changes of configuration from kafka and sends them to VES client.

## What does it do?
The simulator processes notifications from NETCONF server. It does this by being a subscriber of a Kafka topic that is fed 
with NETCONF notifications. The topic name is "config". Incoming notifications are then processed and output of this
 processing is sent to VES client.

### Processing details
1. When last element contain value (equal sign) then cut it together with `'/'` from path and fill attributeList object with key equal to name of element before `'='` and value equal to element after `'='` keeping key and value quoted (`""`),
2. Convert remaining `'/'` into `' , '` ,
3. Convert all container types (without `[key='value']`) to `<container name>=<container name>`
4. Convert all list types (with `[key='value']`) to `<list name>=<value>`
````
{containerA}/{listB}[{keyB}={valueB}]/{containerC}/{listD}[{keyD}={valueD}]/{[leaf, leaf-list]} = {value of leaf}

{
  "variables": {
    "dn": " {containerA}={containerA} , {listB}={valueB} , {containerC}={containerC} , {listD}={valued}",
    "attributesList": {
      "{leaf, leaf-list}": "{value of leaf}"
    }
  }
} 
````

### VES client Request
The resulting request to VES client looks like the following (the "dn" and "attributesList"
 parameters are dependent on the actual NETCONF notification's value):
````
{
  "simulatorParams": {
    "repeatCount": 1,
    "repeatInterval": 1,
    "vesServerUrl": ""
  },
  "templateName": "notification.json",
  "patch": {},
  "variables": {
    "dn": "",
    "attributesList": {}
  }
}
````

### Examples
````
/example-sports:sports/person[name='name 1'] (list instance)

{
  "simulatorParams": { },
  "templateName": "cmNotify.json",
  "patch": { },
  "variables": {
    "dn":" example-sports:sports= example-sports:sports , person=name 1",
    "attributesList": { }
  }        
}
````

````
/example-sports:sports/person[name='name 1']/name = name 1

{
  "simulatorParams": { },
  "templateName": "cmNotify.json",
  "patch": { },
  "variables": {
    "dn":" example-sports:sports= example-sports:sports , person=name 1",
    "attributesList": { "name": "name 2" }
  }        
}
````

````
/example-sports:sports/person[name='name 2'] (list instance)

{
  "simulatorParams": { },
  "templateName": "cmNotify.json",
  "patch": { },
  "variables": {
    "dn":" example-sports:sports= example-sports:sports , person=name 2",
    "attributesList": { }
  }        
}
````

````
/example-sports:sports/team[name='team 1']/player[name='player 1'] (list instance)

{
  "simulatorParams": { },
  "templateName": "cmNotify.json",
  "patch": { },
  "variables": {
    "dn":" example-sports:sports= example-sports:sports , player=player 1",
    "attributesList": { }
  }        
}
````

````
/example-sports:sports/team[name='team 1']/player[name='player 1']/name = player 1
{
  "simulatorParams": { },
  "templateName": "cmNotify.json",
  "patch": { },
   "variables": {
     "dn":" example-sports:sports= example-sports:sports , player=player 1",
     "attributesList": { "name": "player 1"”" }
   }        
}
````
## Simulator configuration
It's possible to override default configuration. Following environment variables can be set 

    KAFKA_BOOTSTRAP_SERVERS - Kafka host, by default kafka1:9092 
    
    KAFKA_APPLICATION_ID - An identifier for the stream processing application. Must be unique within the Kafka cluster. 
                            By default avcn-simulator  
    
    KAFKA_SOURCE_TOPIC - Kafka topic, where Netconf simulator pushes notification, by default config
        
    REST_CLIENT_PNF_SIMULATOR_ENDPOINT -  VES client's URL, by default pnf-simulator:5000/simulator/start
    
    REST_CLIENT_VES_ENDPOINT - VES URL, AVNC events will be send via VES client to this address