Skip to content
Snippets Groups Projects
Commit 8cd8aac3 authored by Henrik Thostrup Jensen's avatar Henrik Thostrup Jensen
Browse files

add support for empty start time in protocol layer (second patch)

parent f142d39b
Branches
Tags
No related merge requests found
...@@ -69,7 +69,10 @@ class ProviderClient: ...@@ -69,7 +69,10 @@ class ProviderClient:
header_element = helper.createRequesterHeader(nsi_header.requester_nsa, nsi_header.provider_nsa, correlation_id=nsi_header.correlation_id) header_element = helper.createRequesterHeader(nsi_header.requester_nsa, nsi_header.provider_nsa, correlation_id=nsi_header.correlation_id)
schedule = nsiconnection.ScheduleType( xmlhelper.createXMLTime(criteria.schedule.start_time), xmlhelper.createXMLTime(criteria.schedule.end_time) ) schedule = nsiconnection.ScheduleType(
xmlhelper.createXMLTime(criteria.schedule.start_time) if criteria.schedule.start_time is not None else None,
xmlhelper.createXMLTime(criteria.schedule.end_time)
)
sd = criteria.service_def sd = criteria.service_def
......
...@@ -93,7 +93,7 @@ class ProviderService: ...@@ -93,7 +93,7 @@ class ProviderService:
# create DTOs (EROs not supported yet) # create DTOs (EROs not supported yet)
start_time = xmlhelper.parseXMLTimestamp(criteria.schedule.startTime) start_time = xmlhelper.parseXMLTimestamp(criteria.schedule.startTime) if criteria.schedule.startTime is not None else None
end_time = xmlhelper.parseXMLTimestamp(criteria.schedule.endTime) end_time = xmlhelper.parseXMLTimestamp(criteria.schedule.endTime)
schedule = nsa.Schedule(start_time, end_time) schedule = nsa.Schedule(start_time, end_time)
......
...@@ -105,8 +105,14 @@ class RequesterClient: ...@@ -105,8 +105,14 @@ class RequesterClient:
schedule = criteria.schedule schedule = criteria.schedule
sd = criteria.service_def sd = criteria.service_def
assert schedule.start_time.tzinfo is None, 'Start time must NOT have time zone' if schedule.start_time is not None:
assert schedule.end_time.tzinfo is None, 'End time must NOT have time zone' assert schedule.start_time.tzinfo is None, 'Start time must NOT have time zone'
start_time = schedule.start_time.replace(tzinfo=tzutc()).isoformat()
else:
start_time = None
assert schedule.end_time.tzinfo is None, 'End time must NOT have time zone'
end_time = schedule.end_time.replace(tzinfo=tzutc()).isoformat()
if not type(sd) is nsa.Point2PointService: if not type(sd) is nsa.Point2PointService:
raise ValueError('Cannot create request for service definition of type %s' % str(type(sd))) raise ValueError('Cannot create request for service definition of type %s' % str(type(sd)))
...@@ -117,8 +123,7 @@ class RequesterClient: ...@@ -117,8 +123,7 @@ class RequesterClient:
params = [ p2pservices.TypeValueType(p[0], p[1]) for p in sd.parameters ] if sd.parameters else None params = [ p2pservices.TypeValueType(p[0], p[1]) for p in sd.parameters ] if sd.parameters else None
service_def = p2pservices.P2PServiceBaseType(sd.capacity, sd.directionality, sd.symmetric, src_stp_id, dst_stp_id, sd.ero, params) service_def = p2pservices.P2PServiceBaseType(sd.capacity, sd.directionality, sd.symmetric, src_stp_id, dst_stp_id, sd.ero, params)
schedule_type = nsiconnection.ScheduleType(schedule.start_time.replace(tzinfo=tzutc()).isoformat(), schedule_type = nsiconnection.ScheduleType(start_time, end_time)
schedule.end_time.replace(tzinfo=tzutc()).isoformat())
#service_type = str(p2pservices.p2ps) #service_type = str(p2pservices.p2ps)
service_type = 'http://services.ogf.org/nsi/2013/12/descriptions/EVTS.A-GOLE' service_type = 'http://services.ogf.org/nsi/2013/12/descriptions/EVTS.A-GOLE'
......
...@@ -70,7 +70,7 @@ class RequesterService: ...@@ -70,7 +70,7 @@ class RequesterService:
# Create DTOs - this overlaps heavily with the parsing done in providerservice - unify sometime # Create DTOs - this overlaps heavily with the parsing done in providerservice - unify sometime
start_time = xmlhelper.parseXMLTimestamp(criteria.schedule.startTime) start_time = xmlhelper.parseXMLTimestamp(criteria.schedule.startTime) if criteria.schedule.startTime is not None else None
end_time = xmlhelper.parseXMLTimestamp(criteria.schedule.endTime) end_time = xmlhelper.parseXMLTimestamp(criteria.schedule.endTime)
schedule = nsa.Schedule(start_time, end_time) schedule = nsa.Schedule(start_time, end_time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment