5fee5db87dbd089235468ef0d1c05e1734f34ddc
[csit.git] / resources / libraries / python / LispSetup.py
1 # Copyright (c) 2016-2019 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 """Library to set up Lisp in topology."""
15
16 from ipaddress import ip_address
17
18 from resources.libraries.python.topology import NodeType
19 from resources.libraries.python.PapiExecutor import PapiSocketExecutor
20 from resources.libraries.python.L2Util import L2Util
21
22 class LispStatus(object):
23     """Class for lisp API."""
24
25     def __init__(self):
26         pass
27
28     @staticmethod
29     def vpp_lisp_enable_disable(node, state):
30         """Enable/Disable lisp in the VPP node in topology.
31
32         :param node: Node of the test topology.
33         :param state: State of the lisp, enable or disable.
34         :type node: dict
35         :type state: str
36         """
37
38         args = dict(is_en=0 if state == 'disable' else 1)
39
40         cmd = 'lisp_enable_disable'
41         err_msg = "Failed to set LISP status on host {host}".format(
42             host=node['host'])
43
44         with PapiSocketExecutor(node) as papi_exec:
45             papi_exec.add(cmd, **args).get_reply(err_msg)
46
47 class LispRemoteMapping(object):
48     """Class for lisp remote mapping API."""
49
50     def __init__(self):
51         pass
52
53     @staticmethod
54     def vpp_add_lisp_remote_mapping(node, vni, deid, deid_prefix, seid,
55                                     seid_prefix, rloc, is_mac=False):
56         """Add lisp remote mapping on the VPP node in topology.
57
58         :param node: VPP node.
59         :param vni: Vni.
60         :param deid: Destination eid address.
61         :param deid_prefix: Destination eid address prefix_len.
62         :param seid: Source eid address.
63         :param seid_prefix: Source eid address prefix_len.
64         :param rloc: Receiver locator.
65         :param is_mac: Set to True if the deid/seid is MAC address.
66         :type node: dict
67         :type vni: int
68         :type deid: str
69         :type deid_prefix: int
70         :type seid: str
71         :type seid_prefix: int
72         :type rloc: str
73         :type is_mac: bool
74         """
75
76         if not is_mac:
77             eid_type = 0 if ip_address(unicode(deid)).version == 4 else 1
78             eid_packed = ip_address(unicode(deid)).packed
79             seid_packed = ip_address(unicode(seid)).packed
80             eid_len = deid_prefix
81             seid_len = seid_prefix
82         else:
83             eid_type = 2
84             eid_packed = L2Util.mac_to_bin(deid)
85             seid_packed = L2Util.mac_to_bin(seid)
86             eid_len = 0
87             seid_len = 0
88
89         rlocs = [dict(is_ip4=1 if ip_address(unicode(rloc)).version == 4 else 0,
90                       addr=ip_address(unicode(rloc)).packed)]
91
92         args = dict(is_add=1,
93                     is_src_dst=1,
94                     vni=int(vni),
95                     eid_type=eid_type,
96                     eid=eid_packed,
97                     eid_len=eid_len,
98                     seid=seid_packed,
99                     seid_len=seid_len,
100                     rloc_num=1,
101                     rlocs=rlocs)
102
103         cmd = 'lisp_add_del_remote_mapping'
104         err_msg = "Failed to add remote mapping on host {host}".format(
105             host=node['host'])
106
107         with PapiSocketExecutor(node) as papi_exec:
108             papi_exec.add(cmd, **args).get_reply(err_msg)
109
110     @staticmethod
111     def vpp_del_lisp_remote_mapping(node, vni, deid, deid_prefix, seid,
112                                     seid_prefix, rloc):
113         """Delete lisp remote mapping on the VPP node in topology.
114
115         :param node: VPP node.
116         :param vni: Vni.
117         :param deid: Destination eid address.
118         :param deid_prefix: Destination eid address prefix_len.
119         :param seid: Source eid address.
120         :param seid_prefix: Source eid address prefix_len.
121         :param rloc: Receiver locator.
122         :type node: dict
123         :type vni: int
124         :type deid: str
125         :type deid_prefix: int
126         :type seid: str
127         :type seid_prefix: int
128         :type rloc: str
129         """
130
131         # used only with IPs
132         is_mac = False
133
134         if not is_mac:
135             eid_type = 0 if ip_address(unicode(deid)).version == 4 else 1
136             eid_packed = ip_address(unicode(deid)).packed
137             seid_packed = ip_address(unicode(seid)).packed
138             eid_len = deid_prefix
139             seid_len = seid_prefix
140         else:
141             eid_type = 2
142             eid_packed = L2Util.mac_to_bin(deid)
143             seid_packed = L2Util.mac_to_bin(seid)
144             eid_len = 0
145             seid_len = 0
146
147         rlocs = [dict(is_ip4=1 if ip_address(unicode(rloc)).version == 4 else 0,
148                       addr=ip_address(unicode(rloc)).packed)]
149
150         args = dict(is_add=0,
151                     is_src_dst=1,
152                     vni=int(vni),
153                     eid_type=eid_type,
154                     eid=eid_packed,
155                     eid_len=eid_len,
156                     seid=seid_packed,
157                     seid_len=seid_len,
158                     rloc_num=1,
159                     rlocs=rlocs)
160
161         cmd = 'lisp_add_del_remote_mapping'
162         err_msg = "Failed to delete remote mapping on host {host}".format(
163             host=node['host'])
164
165         with PapiSocketExecutor(node) as papi_exec:
166             papi_exec.add(cmd, **args).get_reply(err_msg)
167
168 class LispAdjacency(object):
169     """Class for lisp adjacency API."""
170
171     def __init__(self):
172         pass
173
174     @staticmethod
175     def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid,
176                                seid_prefix, is_mac=False):
177         """Add lisp adjacency on the VPP node in topology.
178
179         :param node: VPP node.
180         :param vni: Vni.
181         :param deid: Destination eid address.
182         :param deid_prefix: Destination eid address prefix_len.
183         :param seid: Source eid address.
184         :param seid_prefix: Source eid address prefix_len.
185         :param is_mac: Set to True if the deid/seid is MAC address.
186         :type node: dict
187         :type vni: int
188         :type deid: str
189         :type deid_prefix: int
190         :type seid: str
191         :type seid_prefix: int
192         :type is_mac: bool
193         """
194
195         if not is_mac:
196             eid_type = 0 if ip_address(unicode(deid)).version == 4 else 1
197             reid = ip_address(unicode(deid)).packed
198             leid = ip_address(unicode(seid)).packed
199             reid_len = deid_prefix
200             leid_len = seid_prefix
201         else:
202             eid_type = 2
203             reid = L2Util.mac_to_bin(deid)
204             leid = L2Util.mac_to_bin(seid)
205             reid_len = 0
206             leid_len = 0
207
208         args = dict(is_add=1,
209                     vni=int(vni),
210                     eid_type=eid_type,
211                     reid=reid,
212                     reid_len=reid_len,
213                     leid=leid,
214                     leid_len=leid_len)
215
216         cmd = 'lisp_add_del_adjacency'
217         err_msg = "Failed to add lisp adjacency on host {host}".format(
218             host=node['host'])
219
220         with PapiSocketExecutor(node) as papi_exec:
221             papi_exec.add(cmd, **args).get_reply(err_msg)
222
223     @staticmethod
224     def vpp_del_lisp_adjacency(node, vni, deid, deid_prefix, seid,
225                                seid_prefix):
226         """Delete lisp adjacency on the VPP node in topology.
227
228         :param node: VPP node.
229         :param vni: Vni.
230         :param deid: Destination eid address.
231         :param deid_prefix: Destination eid address prefix_len.
232         :param seid: Source eid address.
233         :param seid_prefix: Source eid address prefix_len.
234         :type node: dict
235         :type vni: int
236         :type deid: str
237         :type deid_prefix: int
238         :type seid: str
239         :type seid_prefix: int
240         """
241
242         # used only with IPs
243         is_mac = False
244
245         if not is_mac:
246             eid_type = 0 if ip_address(unicode(deid)).version == 4 else 1
247             reid = ip_address(unicode(deid)).packed
248             leid = ip_address(unicode(seid)).packed
249             reid_len = deid_prefix
250             leid_len = seid_prefix
251         else:
252             eid_type = 2
253             reid = L2Util.mac_to_bin(deid)
254             leid = L2Util.mac_to_bin(seid)
255             reid_len = 0
256             leid_len = 0
257
258         args = dict(is_add=0,
259                     vni=int(vni),
260                     eid_type=eid_type,
261                     reid=reid,
262                     reid_len=reid_len,
263                     leid=leid,
264                     leid_len=leid_len)
265
266         cmd = 'lisp_add_del_adjacency'
267         err_msg = "Failed to delete lisp adjacency on host {host}".format(
268             host=node['host'])
269
270         with PapiSocketExecutor(node) as papi_exec:
271             papi_exec.add(cmd, **args).get_reply(err_msg)
272
273 class LispGpeStatus(object):
274     """Clas for LISP GPE status manipulation."""
275
276     def __init__(self):
277         pass
278
279     @staticmethod
280     def vpp_lisp_gpe_enable_disable(node, state):
281         """Change the state of LISP GPE - enable or disable.
282
283         :param node: VPP node.
284         :param state: Requested state - enable or disable.
285         :type node: dict
286         :type state: str
287         """
288
289         args = dict(is_en=0 if state == 'disable' else 1)
290
291         cmd = 'gpe_enable_disable'
292         err_msg = "Failed to set LISP GPE status on host {host}".format(
293             host=node['host'])
294
295         with PapiSocketExecutor(node) as papi_exec:
296             papi_exec.add(cmd, **args).get_reply(err_msg)
297
298 class LispGpeForwardEntry(object):
299     """The functionality needed for these methods is not implemented in VPP
300     (VAT). Bug https://jira.fd.io/browse/VPP-334 was open to cover this issue.
301
302     TODO: Implement when VPP-334 is fixed.
303     """
304
305     def __init__(self):
306         pass
307
308     @staticmethod
309     def add_lisp_gpe_forward_entry(node, *args):
310         """Not implemented"""
311         # TODO: Implement when VPP-334 is fixed.
312         pass
313
314     @staticmethod
315     def del_lisp_gpe_forward_entry(node, *args):
316         """Not implemented"""
317         # TODO: Implement when VPP-334 is fixed.
318         pass
319
320
321 class LispMapResolver(object):
322     """Class for Lisp map resolver API."""
323
324     def __init__(self):
325         pass
326
327     @staticmethod
328     def vpp_add_map_resolver(node, map_resolver_ip):
329         """Set lisp map resolver on the VPP node in topology.
330
331         :param node: VPP node.
332         :param map_resolver_ip: IP address of the map resolver.
333         :type node: dict
334         :type map_resolver_ip: str
335         """
336
337         args = dict(is_add=1,
338                     is_ipv6=0 if ip_address(unicode(map_resolver_ip)).version \
339                                  == 4 else 1,
340                     ip_address=ip_address(unicode(map_resolver_ip)).packed)
341
342         cmd = 'lisp_add_del_map_resolver'
343         err_msg = "Failed to add map resolver on host {host}".format(
344             host=node['host'])
345
346         with PapiSocketExecutor(node) as papi_exec:
347             papi_exec.add(cmd, **args).get_reply(err_msg)
348
349     @staticmethod
350     def vpp_del_map_resolver(node, map_resolver_ip):
351         """Unset lisp map resolver on the VPP node in topology.
352
353         :param node: VPP node.
354         :param map_resolver_ip: IP address of the map resolver.
355         :type node: dict
356         :type map_resolver_ip: str
357         """
358
359         args = dict(is_add=0,
360                     is_ipv6=0 if ip_address(unicode(map_resolver_ip)).version \
361                                  == 4 else 1,
362                     ip_address=ip_address(unicode(map_resolver_ip)).packed)
363
364         cmd = 'lisp_add_del_map_resolver'
365         err_msg = "Failed to delete map resolver on host {host}".format(
366             host=node['host'])
367
368         with PapiSocketExecutor(node) as papi_exec:
369             papi_exec.add(cmd, **args).get_reply(err_msg)
370
371 class LispLocalEid(object):
372     """Class for Lisp local eid API."""
373
374     def __init__(self):
375         pass
376
377     @staticmethod
378     def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid,
379                                prefix_len=None):
380         """Set lisp eid address on the VPP node in topology.
381
382         :param node: VPP node.
383         :param locator_set_name: Name of the locator_set.
384         :param vni: vni value.
385         :param eid: Eid value.
386         :param prefix_len: prefix len if the eid is IP address.
387         :type node: dict
388         :type locator_set_name: str
389         :type vni: int
390         :type eid: str
391         :type prefix_len: int
392         """
393
394         if prefix_len:
395             eid_type = 0 if ip_address(unicode(eid)).version == 4 else 1
396             eid_packed = ip_address(unicode(eid)).packed
397         else:
398             eid_type = 2
399             eid_packed = L2Util.mac_to_bin(eid)
400
401         args = dict(is_add=1,
402                     eid_type=eid_type,
403                     eid=eid_packed,
404                     prefix_len=prefix_len,
405                     locator_set_name=locator_set_name,
406                     vni=int(vni))
407
408         cmd = 'lisp_add_del_local_eid'
409         err_msg = "Failed to add local eid on host {host}".format(
410             host=node['host'])
411
412         with PapiSocketExecutor(node) as papi_exec:
413             papi_exec.add(cmd, **args).get_reply(err_msg)
414
415     @staticmethod
416     def vpp_del_lisp_local_eid(node, locator_set_name, vni, eid,
417                                prefix_len=None):
418         """Set lisp eid addres on the VPP node in topology.
419
420         :param node: VPP node.
421         :param locator_set_name: Name of the locator_set.
422         :param vni: vni value.
423         :param eid: Eid value.
424         :param prefix_len: prefix len if the eid is IP address.
425         :type node: dict
426         :type locator_set_name: str
427         :type vni: int
428         :type eid: str
429         :type prefix_len: int
430         """
431
432         if prefix_len:
433             eid_type = 0 if ip_address(unicode(eid)).version == 4 else 1
434             eid_packed = ip_address(unicode(eid)).packed
435         else:
436             eid_type = 2
437             eid_packed = L2Util.mac_to_bin(eid)
438
439         args = dict(is_add=0,
440                     eid_type=eid_type,
441                     eid=eid_packed,
442                     prefix_len=prefix_len,
443                     locator_set_name=locator_set_name,
444                     vni=int(vni))
445
446         cmd = 'lisp_add_del_local_eid'
447         err_msg = "Failed to delete local eid on host {host}".format(
448             host=node['host'])
449
450         with PapiSocketExecutor(node) as papi_exec:
451             papi_exec.add(cmd, **args).get_reply(err_msg)
452
453 class LispLocator(object):
454     """Class for the Lisp Locator API."""
455
456     def __init__(self):
457         pass
458
459     @staticmethod
460     def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight):
461         """Set lisp locator on the VPP node in topology.
462
463         :param node: VPP node.
464         :param locator_name: Name of the locator_set.
465         :param sw_if_index: sw_if_index if the interface.
466         :param priority: priority of the locator.
467         :param weight: weight of the locator.
468         :type node: dict
469         :type locator_name: str
470         :type sw_if_index: int
471         :type priority: int
472         :type weight: int
473         """
474
475         args = dict(is_add=1,
476                     locator_set_name=locator_name,
477                     sw_if_index=sw_if_index,
478                     priority=priority,
479                     weight=weight)
480
481         cmd = 'lisp_add_del_locator'
482         err_msg = "Failed to add locator on host {host}".format(
483             host=node['host'])
484
485         with PapiSocketExecutor(node) as papi_exec:
486             papi_exec.add(cmd, **args).get_reply(err_msg)
487
488     @staticmethod
489     def vpp_del_lisp_locator(node, locator_name, sw_if_index, priority, weight):
490         """Unset lisp locator on the VPP node in topology.
491
492         :param node: VPP node.
493         :param locator_name: Name of the locator_set.
494         :param sw_if_index: sw_if_index if the interface.
495         :param priority: priority of the locator.
496         :param weight: weight of the locator.
497         :type node: dict
498         :type locator_name: str
499         :type sw_if_index: int
500         :type priority: int
501         :type weight: int
502         """
503
504         args = dict(is_add=0,
505                     locator_set_name=locator_name,
506                     sw_if_index=sw_if_index,
507                     priority=priority,
508                     weight=weight)
509
510         cmd = 'lisp_add_del_locator'
511         err_msg = "Failed to delete locator on host {host}".format(
512             host=node['host'])
513
514         with PapiSocketExecutor(node) as papi_exec:
515             papi_exec.add(cmd, **args).get_reply(err_msg)
516
517 class LispLocatorSet(object):
518     """Class for Lisp Locator Set API."""
519
520     def __init__(self):
521         pass
522
523     @staticmethod
524     def vpp_add_lisp_locator_set(node, name):
525         """Add lisp locator_set on VPP.
526
527         :param node: VPP node.
528         :param name: VPP locator name.
529         :type node: dict
530         :type name: str
531         """
532
533         args = dict(is_add=1,
534                     locator_set_name=name,
535                     locator_num=0,
536                     locators=[])
537
538         cmd = 'lisp_add_del_locator_set'
539         err_msg = "Failed to add locator set on host {host}".format(
540             host=node['host'])
541
542         with PapiSocketExecutor(node) as papi_exec:
543             papi_exec.add(cmd, **args).get_reply(err_msg)
544
545     @staticmethod
546     def vpp_del_lisp_locator_set(node, name):
547         """Del lisp locator_set on VPP.
548
549         :param node: VPP node.
550         :param name: VPP locator name.
551         :type node: dict
552         :type name: str
553         """
554
555         args = dict(is_add=0,
556                     locator_set_name=name,
557                     locator_num=0,
558                     locators=[])
559
560         cmd = 'lisp_add_del_locator_set'
561         err_msg = "Failed to delete locator set on host {host}".format(
562             host=node['host'])
563
564         with PapiSocketExecutor(node) as papi_exec:
565             papi_exec.add(cmd, **args).get_reply(err_msg)
566
567 class LispSetup(object):
568     """Lisp setup in topology."""
569
570     def __init__(self):
571         pass
572
573     @staticmethod
574     def vpp_set_lisp_locator_set(node, locator_set_list):
575         """Set lisp locator_sets on VPP node in topology.
576
577         :param node: VPP node.
578         :param locator_set_list: List of locator_set.
579         :type node: dict
580         :type locator_set_list: list
581         """
582
583         if node['type'] != NodeType.DUT:
584             raise ValueError('Node is not DUT')
585
586         lisp_locator = LispLocator()
587         lisp_locator_set = LispLocatorSet()
588         for locator_set in locator_set_list:
589             locator_set_name = locator_set.get('locator-set')
590             locator_list = locator_set.get('locator')
591             lisp_locator_set.vpp_add_lisp_locator_set(node,
592                                                       locator_set_name)
593             for locator in locator_list:
594                 sw_if_index = locator.get('locator-index')
595                 priority = locator.get('priority')
596                 weight = locator.get('weight')
597                 lisp_locator.vpp_add_lisp_locator(node,
598                                                   locator_set_name,
599                                                   sw_if_index,
600                                                   priority,
601                                                   weight)
602
603     @staticmethod
604     def vpp_unset_lisp_locator_set(node, locator_set_list):
605         """Unset lisp locator_sets on VPP node in topology.
606
607         :param node: VPP node.
608         :param locator_set_list: List of locator_set.
609         :type node: dict
610         :type locator_set_list: list
611         """
612
613         if node['type'] != NodeType.DUT:
614             raise ValueError('Lisp locator set, node is not DUT')
615
616         lisp_locator = LispLocator()
617         lisp_locator_set = LispLocatorSet()
618         for locator_set in locator_set_list:
619             locator_set_name = locator_set.get('locator-set')
620             locator_list = locator_set.get('locator')
621             for locator in locator_list:
622                 sw_if_index = locator.get('locator-index')
623                 priority = locator.get('priority')
624                 weight = locator.get('weight')
625                 lisp_locator.vpp_del_lisp_locator(node,
626                                                   locator_set_name,
627                                                   sw_if_index,
628                                                   priority,
629                                                   weight)
630
631             lisp_locator_set.vpp_del_lisp_locator_set(node,
632                                                       locator_set_name)
633
634     @staticmethod
635     def vpp_set_lisp_eid_table(node, eid_table):
636         """Set lisp eid tables on VPP node in topology.
637
638         :param node: VPP node.
639         :param eid_table: Dictionary containing information of eid_table.
640         :type node: dict
641         :type eid_table: dict
642         """
643
644         if node['type'] != NodeType.DUT:
645             raise ValueError('Node is not DUT')
646
647         lisp_locator_set = LispLocatorSet()
648         lisp_eid = LispLocalEid()
649         for eid in eid_table:
650             vni = eid.get('vni')
651             eid_address = eid.get('eid')
652             eid_prefix_len = eid.get('eid-prefix-len')
653             locator_set_name = eid.get('locator-set')
654             lisp_locator_set.vpp_add_lisp_locator_set(node, locator_set_name)
655             lisp_eid.vpp_add_lisp_local_eid(node,
656                                             locator_set_name,
657                                             vni,
658                                             eid_address,
659                                             eid_prefix_len)
660
661     @staticmethod
662     def vpp_unset_lisp_eid_table(node, eid_table):
663         """Unset lisp eid tables on VPP node in topology.
664
665         :param node: VPP node.
666         :param eid_table: Dictionary containing information of eid_table.
667         :type node: dict
668         :type eid_table: dict
669         """
670
671         if node['type'] != NodeType.DUT:
672             raise ValueError('Node is not DUT')
673
674         locator_set_list = []
675         lisp_locator_set = LispLocatorSet()
676         lisp_eid = LispLocalEid()
677         for eid in eid_table:
678             vni = eid.get('vni')
679             eid_address = eid.get('eid')
680             eid_prefix_len = eid.get('eid-prefix-len')
681             locator_set_name = eid.get('locator-set')
682             if locator_set_name not in locator_set_list:
683                 locator_set_list.append(locator_set_name)
684
685             lisp_eid.vpp_del_lisp_local_eid(node,
686                                             locator_set_name,
687                                             vni,
688                                             eid_address,
689                                             eid_prefix_len)
690
691         for locator_set_name in locator_set_list:
692             lisp_locator_set.vpp_del_lisp_locator_set(node, locator_set_name)
693
694     @staticmethod
695     def vpp_set_lisp_map_resolver(node, map_resolver):
696         """Set lisp map resolvers on VPP node in topology.
697
698         :param node: VPP node.
699         :param map_resolver: Dictionary containing information of map resolver.
700         :type node: dict
701         :type map_resolver: dict
702         """
703
704         lisp_map_res = LispMapResolver()
705         for map_ip in map_resolver:
706             lisp_map_res.vpp_add_map_resolver(node, map_ip.get('map resolver'))
707
708     @staticmethod
709     def vpp_unset_lisp_map_resolver(node, map_resolver):
710         """Unset lisp map resolvers on VPP node in topology.
711
712         :param node: VPP node.
713         :param map_resolver: Dictionary containing information of map resolver.
714         :type node: dict
715         :type map_resolver: dict
716         """
717
718         lisp_map_res = LispMapResolver()
719         for map_ip in map_resolver:
720             lisp_map_res.vpp_del_map_resolver(node, map_ip.get('map resolver'))
721
722 class LispEidTableMap(object):
723     """
724     Class for EID table map.
725     """
726
727     @staticmethod
728     def vpp_lisp_eid_table_mapping(node, vni, bd_id=None, vrf=None):
729         """
730         Map LISP VNI to either bridge domain ID, or VRF ID.
731
732         :param node: VPP node.
733         :param vni: Lisp VNI.
734         :param bd_id: Bridge domain ID.
735         :param vrf: VRF id.
736         :type node: dict
737         :type vni: int
738         :type bd_id: int
739         :type vrf: int
740         """
741
742         # adding default mapping vni=0, vrf=0 needs to be skipped
743         skip = False
744
745         if bd_id:
746             is_l2 = 1
747             dp_table = bd_id
748         else:
749             is_l2 = 0
750             dp_table = vrf
751             # skip adding default mapping
752             if (int(vrf) == 0) and (int(vni) == 0):
753                 skip = True
754
755         args = dict(is_add=1,
756                     vni=int(vni),
757                     dp_table=int(dp_table),
758                     is_l2=is_l2)
759
760         cmd = 'lisp_eid_table_add_del_map'
761         err_msg = "Failed to add eid table map on host {host}".format(
762             host=node['host'])
763
764         if not skip:
765             with PapiSocketExecutor(node) as papi_exec:
766                 papi_exec.add(cmd, **args).get_reply(err_msg)