예제 #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")