Add support for type-only interfaces
Modify Maker template for type-only interfaces that do not
have properties.
Resolves openbmc/openbmc#1786
Change-Id: I2c48b37cf273943a0c696f6b92db0bc901a1c9b4
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/pimgen.py b/pimgen.py
index a31267f..de5419d 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -44,7 +44,9 @@
return self.dict.keys()
def names(self, interface):
- names = [x["name"] for x in self.dict[interface]]
+ names = []
+ if self.dict[interface]:
+ names = [x["name"] for x in self.dict[interface]]
return names
@@ -283,13 +285,13 @@
for interface, properties, in interfaces.iteritems():
key_i = TrivialArgument(value=interface, type='string')
value_p = []
-
- for prop, value in properties.iteritems():
- key_p = TrivialArgument(value=prop, type='string')
- value_v = TrivialArgument(
- decorators=[Literal(value.get('type', None))],
- **value)
- value_p.append(InitializerList(values=[key_p, value_v]))
+ if properties:
+ for prop, value in properties.iteritems():
+ key_p = TrivialArgument(value=prop, type='string')
+ value_v = TrivialArgument(
+ decorators=[Literal(value.get('type', None))],
+ **value)
+ value_p.append(InitializerList(values=[key_p, value_v]))
value_p = InitializerList(values=value_p)
value_i.append(InitializerList(values=[key_i, value_p]))
@@ -536,13 +538,9 @@
i = y.replace('.interface.yaml', '').replace(os.sep, '.')
# PIM can't create interfaces with methods.
- # PIM can't create interfaces without properties.
parsed = yaml.safe_load(fd.read())
if parsed.get('methods', None):
continue
- properties = parsed.get('properties', None)
- if not properties:
- continue
# Cereal can't understand the type sdbusplus::object_path. This
# type is a wrapper around std::string. Ignore interfaces having
# a property of this type for now. The only interface that has a
@@ -551,8 +549,10 @@
# this interface.
# TODO via openbmc/openbmc#2123 : figure out how to make Cereal
# understand sdbusplus::object_path.
- if any('path' in p['type'] for p in properties):
- continue
+ properties = parsed.get('properties', None)
+ if properties:
+ if any('path' in p['type'] for p in properties):
+ continue
interface_composite[i] = properties
interfaces.append(i)