NORDUnet / opennsa

Open-source implementation of the NSI protocol with support for different backends
BSD 3-Clause "New" or "Revised" License
13 stars 19 forks source link

Add support for SOAPFaults. #28

Open jmacauley opened 3 years ago

jmacauley commented 3 years ago

Look like onsa command line has issues handling SOAP faults returned from service providers. The following error was generated when a SOAP fault was received for invalid message contents.

opennsa@nsi0:~$ onsa reserveprovision -s calit2.optiputer.net:2020:prism-core:k8s-gen4-01#vlan=1779 -d calit2.optiputer.net:2020:prism-core:k8s-gen4-02#vlan=1779 -y
Site (TLS) starting on 7080
Starting factory <twisted.web.server.Site object at 0x7ffad832c6a0>
Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 1475, in gotResult
    _inlineCallbacks(r, g, status)
--- <exception caught here> ---
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/lib/python3.7/dist-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/local/bin/onsa", line 196, in doMain
    yield commands.reserveprovision(client, nsi_header, source_stp, dest_stp, start_time, end_time, bandwidth, ero, connection_id, global_id, notification_wait)
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/lib/python3.7/dist-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/local/lib/python3.7/dist-packages/opennsa/cli/commands.py", line 147, in reserveprovision
    connection_id, _,_, criteria = yield client.reserve(nsi_header, connection_id, global_id, 'Test Connection', crt)
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/opennsa/protocols/nsi2/requesterclient.py", line 135, in _handleAck
    header, ack = helper.parseRequest(soap_data)
  File "/usr/local/lib/python3.7/dist-packages/opennsa/protocols/nsi2/helper.py", line 154, in parseRequest
    body = nsiconnection.parseElement(bodies[0])
  File "/usr/local/lib/python3.7/dist-packages/opennsa/protocols/nsi2/bindings/nsiconnection.py", line 962, in parseElement
    raise ValueError('No type mapping for tag %s' % element.tag)
builtins.ValueError: No type mapping for tag {http://schemas.xmlsoap.org/soap/envelope/}Fault

(TLS Port 7080 Closed)
Stopping factory <twisted.web.server.Site object at 0x7ffad832c6a0>
opennsa@nsi0:~$ 

Here is the SOAP Fault generated by the Safnari NSI provider:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <nsi_headers:nsiHeader xmlns:gnsbod="http://nordu.net/namespaces/2013/12/gnsbod" xmlns:nsi_ctypes="http://schemas.ogf.org/nsi/2013/12/connection/types"
            xmlns:nsi_ftypes="http://schemas.ogf.org/nsi/2013/12/framework/types" xmlns:nsi_headers="http://schemas.ogf.org/nsi/2013/12/framework/headers"
            xmlns:nsi_p2p="http://schemas.ogf.org/nsi/2013/12/services/point2point" xmlns:nsi_stypes="http://schemas.ogf.org/nsi/2013/12/services/types"
            xmlns:path_trace="http://schemas.ogf.org/nsi/2015/04/connection/pathtrace" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
            <protocolVersion>application/vnd.ogf.nsi.cs.v2.provider+soap</protocolVersion>
            <correlationId>urn:uuid:e91395de-2143-11ec-aafc-ce184112601b</correlationId>
            <requesterNSA>urn:ogf:network:calit2.optiputer.net:2020:onsa-cli</requesterNSA>
            <providerNSA>urn:ogf:network:es.net:2013:nsa:nsi-aggr-west</providerNSA>
        </nsi_headers:nsiHeader>
    </soapenv:Header>
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>Parameter provided contains an unsupported value that MUST be processed</faultstring>
            <detail>
                <nsi_ctypes:serviceException xmlns:gnsbod="http://nordu.net/namespaces/2013/12/gnsbod" xmlns:nsi_ctypes="http://schemas.ogf.org/nsi/2013/12/connection/types"
                    xmlns:nsi_ftypes="http://schemas.ogf.org/nsi/2013/12/framework/types" xmlns:nsi_headers="http://schemas.ogf.org/nsi/2013/12/framework/headers"
                    xmlns:nsi_p2p="http://schemas.ogf.org/nsi/2013/12/services/point2point" xmlns:nsi_stypes="http://schemas.ogf.org/nsi/2013/12/services/types"
                    xmlns:path_trace="http://schemas.ogf.org/nsi/2015/04/connection/pathtrace" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
                    <nsaId>urn:ogf:network:es.net:2013:nsa:nsi-aggr-west</nsaId>
                    <errorId>00102</errorId>
                    <text>Parameter provided contains an unsupported value that MUST be processed</text>
                    <variables>
                        <variable namespace="http://schemas.ogf.org/nsi/2013/12/framework/headers" type="providerNSA">
                            <value>urn:ogf:network:calit2.optiputer.net:2020:nsa</value>
                        </variable>
                    </variables>
                </nsi_ctypes:serviceException>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>