You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There exist an inconsistency with handling the AttributeStates in the code, which is due to the fact that their values can be stored in two places:
The EStructuralFeatures of the MixinBases
The AttributeState list of the MixinBases
Ideally, these two things should be synchronized and calls to the corresponding getters and setters should yield the same values.
Consider the example below (which is part of a NetworkInterfaceConnector generated with help of OCCIware Studio, slightly modified to fit this issue report):
public void occiRetrieve()
{
LOGGER.debug("occiRetrieve() called on " + this);
...
port = os.networking().port().get(port.getId());
...
// Update IP address
for (MixinBase mixin: this.getParts()) {
// find corresponding mixinbase
if (mixin instanceof Ipnetworkinterface) {
LOGGER.debug("Associated port has IP: "
+ port.getIP();
// set the attribute accordingly
OcciHelper.setAttribute(mixin,
"occi.networkinterface.address", port.getIP())
}
}
for (AttributeState state: this.getAttributes()) {
LOGGER.info(state.getName() + ": " + state.getValue());
}
}
Executing this code with the MartServer gives:
2018-03-14 13:38:57.270 INFO occi.core.id:
4ab430ad-da63-483c-8f50-9abbf056da26
2018-03-14 13:38:57.270 INFO occi.core.title: link1
2018-03-14 13:38:57.270 INFO occi.networkinterface.interface:
2018-03-14 13:38:57.270 INFO occi.networkinterface.mac:
2018-03-14 13:38:57.270 INFO occi.networkinterface.state: active
2018-03-14 13:38:57.270 INFO occi.networkinterface.state.message:
2018-03-14 13:38:57.270 INFO occi.networkinterface.address:
2018-03-14 13:38:57.270 INFO occi.networkinterface.gateway:
2018-03-14 13:38:57.270 INFO occi.networkinterface.allocation: dynamic
2018-03-14 13:38:57.270 WARN Attributes retrieves on mixin :
org.modmacao.openstack.connector.IpnetworkinterfaceConnector@87929e2
(occiNetworkinterfaceAddress: 10.0.0.6, occiNetworkinterfaceGateway:
null, occiNetworkinterfaceAllocation: dynamic) --> []
Here the part
occi.networkinterface.address:
should be
occi.networkinterface.address: 10.0.0.6
Obviously, the IP address is set correctly in the Mixin, but not in the
AttributeState of the NetworkInterface.
The text was updated successfully, but these errors were encountered:
I discovered that the different methods to retrieve and set AttributeStates show the following behaviour, which leads to the problem mentioned in the issue above:
Sets the value of the EStructuralFeature, IF it exists, ELSE a corresponding AttributeState is set.
MixinBase.getAttributes():
Returns a list of the AttributeStates, NOT synchronized with the values of the EStructuralFeatures.
Maybe, I am using the methods in a way which is not intended, so the question for me is: What is the indented behaviour?
Should the synchronization be left to the user or is that something which could be provided by the OCCIHelper, e.g. it could offer a method
OCCIHelper.getAttributeValue(MixinBase mixinBase, String attributeName) which returns the corresponding value regardless of if it is stored in an AttributeState or an EStructuralFeature. In case, this method is implemented, maybe the old method OCCIHelper.getAttribute(MixinBase mixinBase, ...) should be renamed to OCCIHelper.getAttributeValue(MixinBase mixinBase, ...) to be consistent.
Another solution could be to change the behaviour of OCCIHelper.setAttribute(...) such that it always sets the value of the AttributeState AND the EStructuralFeature. Of course this would be a waste of resources.
There exist an inconsistency with handling the AttributeStates in the code, which is due to the fact that their values can be stored in two places:
Ideally, these two things should be synchronized and calls to the corresponding getters and setters should yield the same values.
Consider the example below (which is part of a NetworkInterfaceConnector generated with help of OCCIware Studio, slightly modified to fit this issue report):
Executing this code with the MartServer gives:
Here the part
should be
Obviously, the IP address is set correctly in the Mixin, but not in the
AttributeState of the NetworkInterface.
The text was updated successfully, but these errors were encountered: