Opened 12 years ago

Closed 12 years ago

#113 closed (fixed)

sliver local_name is wrong

Reported by: sedwards@bbn.com Owned by: pbohan@bbn.com
Priority: major Milestone: gmoc.py data submission debugging
Component: Clients Version:
Keywords: Cc:
Dependencies:

Description (last modified by sedwards@bbn.com)

My output is generating funny URNs:

		<sliver approved="0" created="1348885835" creator="urn:publicid:IDN+pgeni.gpolab.bbn.com+user+lnevers" expires="1350091835" local_name="urn:publicid:IDN+gmoc.geni.net+sliver+urn:publicid:IDN+exogeni.net:bbnvmsite+sliver+2acb3763-d043-4296-8ba5-b7af98eb3c8a#geni2" slice_urn="urn:publicid:IDN+pgeni.gpolab.bbn.com+slice+acclne-2029400" slice_uuid="739e7b11-3318-4951-94de-3985fa1669af" state="Unknown" uuid="">
			<resource_mapping local_name="urn:publicid:IDN+gmoc.geni.net+sliver+urn:publicid:IDN+exogeni.net:bbnvmsite+sliver+2acb3763-d043-4296-8ba5-b7af98eb3c8a#geni2" resource="urn:publicid:IDN+exogeni.net:bbnvmsite+node+orca-vm-cloud" type="vm"/>

In particular, notice:

local_name="urn:publicid:IDN+gmoc.geni.net+sliver+urn:publicid:IDN+exogeni.net:bbnvmsite+sliver+2acb3763-d043-4296-8ba5-b7af98eb3c8a#geni2"

See also #119.

Change History (7)

comment:1 Changed 12 years ago by sedwards@bbn.com

Owner: changed from somebody to sedwards@bbn.com

So this is happening because the original urn is:

sliver_id="urn:publicid:IDN+exogeni.net:bbnvmsite+sliver+c237b9ac-b16c-4856-acfb-ea000ea2ccda#geni1"

Note that this ends in #geni.

We stole this code from gcf to validate URNS and it doesn't believe # is a valid character for a URN.

# validate urn
# Note that this is not sufficient but it is necessary
def is_valid_urn_string(instr):
    '''Could this string be part of a URN'''
    if instr is None or not isinstance(instr, str):
        return False
    #No whitespace
    # no # or ? or /
    if re.search("[\s|\?\/\#]", instr) is None:
        return True
    return False

I'm emailing Aaron to discuss the validity of these URNs and who we should push on to fix this.

comment:2 Changed 12 years ago by sedwards@bbn.com

Aaron says it's fine to ignore the #.

In particular he suggests that we should assume that if it starts with urn:publicid:IDN+ that it's a URN.

comment:3 Changed 12 years ago by sedwards@bbn.com

Ok. So this is a really simple fix.

I think we should just change:

def isValidURN(urn):
    if not isinstance(urn, str):
        return False

    if re.search("[\s|\?\/\#]", urn) is None:
        if urn.startswith(URN_PREFIX):
            return True

    return False 

To this:

def isValidURN(urn):
    if not isinstance(urn, str):
        return False


    if urn.startswith(URN_PREFIX):
        return True

    return False 

For two reasons:

1) If we keep the old code and we have improper URNs that look like URNs, we will end up prepending the URN_PREFIX on them which is ugly.

2) On the other hand, if we just use whatever string is passed in then some IDs will be URNs and some not. And I think that will confuse us later.

comment:4 Changed 12 years ago by sedwards@bbn.com

Ok. After further discussion with Chaos, we think that we should just make the smaller change to be tolerant of # in URNs and I'll make another ticket for allowing URN-like things in the future.

So the change should be:

def isValidURN(urn):
    if not isinstance(urn, str):
        return False

# Make sure no invalid characters are in the URN
#    if re.search("[\s|\?\/\#]", urn) is None:
# For now, be tolerant of # in ExoGENI URNs
    if re.search("[\s|\?\/]", urn) is None:
        if urn.startswith(URN_PREFIX):
            return True

    return False 

comment:5 Changed 12 years ago by sedwards@bbn.com

Owner: changed from sedwards@bbn.com to pbohan@bbn.com

comment:6 Changed 12 years ago by sedwards@bbn.com

Description: modified (diff)

comment:7 Changed 12 years ago by sedwards@bbn.com

Resolution: fixed
Status: newclosed

This is fixed in v0.8.0.

Note: See TracTickets for help on using tickets.