コード例 #1
0
def __main__():
    parser = argparse.ArgumentParser(description="Command-line Interface for IoTDM Python Client")
    parser.add_argument('protocol', help='Protocol for Requests', choices=['http', 'coap'], type=str)
    parser.add_argument('--from', '-fr', dest='from', help='From Which IP Address', type=str)
    parser.add_argument('--to', '-t', dest='host', help='To Which IP Address', type=str)
    parser.add_argument('--path', '-pa', dest='path', help='path', type=str, default='')
    parser.add_argument('--name', '-nm', dest='name', help='Resource Name', type=str)
    parser.add_argument('--op', '-o', dest='operation', help='Operation', choices=['restconf', 'kill', 'create', 'retrieve', 'update', 'delete'], type=str, required=True)
    parser.add_argument('--port', '-p', dest='port', help='Port Number', type=str)
    parser.add_argument('--primitiveContent', '-pc', dest='payload', help='payload', type=str)
    parser.add_argument('--requestIdentifier', '-rqi', dest='rqi', help='Request ID', type=str)
    parser.add_argument('--resourceType', '-ty', dest='ty', help='Resource Type', type=str)

    args = parser.parse_args()

    url = '%s://%s' %(args.protocol, args.host)

    if args.operation == 'restconf':
        iotdm_api.restConf(url, args.name, 'admin', 'admin')


    if args.operation == 'kill':
        iotdm_api.cleanup(url, 'admin', 'admin')


    if args.operation == 'create':
        url = url + ':%s/%s' %(args.port, args.path)
        iotdm_api.create(url, args.ty, args.name, args.payload)


    if args.operation == 'retrieve':
        url = url + ':%s/%s' %(args.port, args.path)
        iotdm_api.retrieve(url)


    if args.operation == 'update':
        url = url + ':%s/%s' %(args.port, args.path)
        iotdm_api.update(url, args.ty, args.payload)


    if args.operation == 'delete':
        url = url + ':%s/%s' %(args.port, args.path)
        iotdm_api.delete(url)
コード例 #2
0
 def test_TD_M2M_SH_07_Retrieve_MgmtObj(self):
     iotdm_api.retrieve(
         "coap://localhost:5683/ODL-oneM2M-Cse/TestNode/TestFirmware",
         origin="CSE3219/C9886",
         requestID="12345")
コード例 #3
0
 def test_TD_M2M_NH_27_Retrieve_AccessControlPolicy(self):
     iotdm_api.retrieve(
         "coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestACP",
         origin="admin",
         requestID="12345")
コード例 #4
0
 def test_TD_M2M_NH_23_Retrieve_Subscription(self):
     iotdm_api.retrieve(
         "coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestContainer/TestSubscription",
         origin="CSE3219/C9886",
         requestID="12345")
コード例 #5
0
 def test_TD_M2M_NH_21_Discovery_with_multiple_filter_criteria(self):
     iotdm_api.retrieve(
         "coap://localhost:5683/ODL-oneM2M-Cse?fu=1&lbl=key1&lbl=key2",
         origin="CSE3219/C9886",
         requestID="12345")
コード例 #6
0
 def test_TD_M2M_NH_18_Discovery_of_all_resources(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse?fu=1",
                        origin="CSE3219/C9886",
                        requestID="12345")
コード例 #7
0
 def test_TD_M2M_NH_15_Retrieve_ContentInstance(self):
     iotdm_api.retrieve(
         "coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestContainer/TestContentInstance",
         origin="CSE3219/C9886",
         requestID="12345")
コード例 #8
0
 def test_TD_M2M_NH_27_Retrieve_AccessControlPolicy(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestACP", origin="admin", requestID="12345")
コード例 #9
0
 def test_TD_M2M_NH_19_Discovery_with_label_filter_criteria(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse?fu=1&lbl=key1", origin="CSE3219/C9886", requestID="12345")
コード例 #10
0
 def test_TD_M2M_NH_18_Discovery_of_all_resources(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse?fu=1", origin="CSE3219/C9886", requestID="12345")
コード例 #11
0
 def test_TD_M2M_NH_15_Retrieve_ContentInstance(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestContainer/TestContentInstance", origin="CSE3219/C9886", requestID="12345")
コード例 #12
0
 def test_TD_M2M_NH_07_Retrieve_AE(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestAE", origin="CSE3219/C9886", requestID="12345")
コード例 #13
0
 def test_TD_M2M_NH_03_Retrieve_RemoteCSE(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/RemoteCSE", origin="CSE3219", requestID="12345")
コード例 #14
0
 def test_TD_M2M_SH_07_Retrieve_MgmtObj(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestNode/TestFirmware", origin="CSE3219/C9886", requestID="12345")
コード例 #15
0
 def test_TD_M2M_NH_03_Retrieve_RemoteCSE(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/RemoteCSE",
                        origin="CSE3219",
                        requestID="12345")
コード例 #16
0
 def test_TD_M2M_NH_07_Retrieve_AE(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestAE",
                        origin="CSE3219/C9886",
                        requestID="12345")
コード例 #17
0
 def test_TD_M2M_NH_23_Retrieve_Subscription(self):
     iotdm_api.retrieve("coap://localhost:5683/ODL-oneM2M-Cse/TestAE/TestContainer/TestSubscription", origin="CSE3219/C9886", requestID="12345")