vppapigen: do not allow to define message as both request and reply 75/10975/2
authorMarek Gradzki <mgradzki@cisco.com>
Tue, 6 Mar 2018 10:10:56 +0000 (11:10 +0100)
committerOle Trøan <otroan@employees.org>
Tue, 6 Mar 2018 11:24:26 +0000 (11:24 +0000)
Change-Id: I0738fac32dd0c5d927c52d2eb2c1100d14c147cf
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
src/tools/vppapigen/vppapigen.py

index a1bb0e1..57e5e3a 100755 (executable)
@@ -574,6 +574,7 @@ class VPPAPI(object):
 
         msgs = {d.name: d for d in s['defines']}
         svcs = {s.caller: s for s in s['services']}
+        replies = {s.reply: s for s in s['services']}
         seen_services = {}
 
         for service in svcs:
@@ -584,6 +585,9 @@ class VPPAPI(object):
                 raise ValueError('Service definition refers to unknown message'
                                  ' definition in reply: {}'
                                  .format(svcs[service].reply))
+            if service in replies:
+                raise ValueError('Service definition refers to message'
+                                 ' marked as reply: {}'.format(service))
             for event in svcs[service].events:
                 if event not in msgs:
                     raise ValueError('Service definition refers to unknown '