Skip to content

Inconsistent handling of EStructuralFeatures and AttributeStates in MixinBases #62

@kortef

Description

@kortef

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:

  1. The EStructuralFeatures of the MixinBases
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions