Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tfs/controller
1 result
Show changes
Showing
with 107 additions and 4410 deletions
syntax = "proto3";
package context;
message Empty {}
message Uuid {
string uuid = 1;
}
enum EventTypeEnum {
EVENTTYPE_UNDEFINED = 0;
EVENTTYPE_CREATE = 1;
EVENTTYPE_UPDATE = 2;
EVENTTYPE_REMOVE = 3;
}
message Timestamp {
double timestamp = 1;
}
message Event {
Timestamp timestamp = 1;
EventTypeEnum event_type = 2;
}
message TeraFlowController {
ContextId context_id = 1;
string ip_address = 2;
uint32 port = 3;
}
message ContextId {
Uuid context_uuid = 1;
}
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package dlt;
import "context.proto";
service DltGatewayService {
rpc RecordToDlt (DltRecord ) returns ( DltRecordStatus ) {}
rpc GetFromDlt (DltRecordId ) returns ( DltRecord ) {}
rpc SubscribeToDlt(DltRecordSubscription ) returns (stream DltRecordEvent ) {}
rpc GetDltStatus (context.TeraFlowController) returns ( DltPeerStatus ) {} // NEC is checking if it is possible
rpc GetDltPeers (context.Empty ) returns ( DltPeerStatusList) {} // NEC is checking if it is possible
}
enum DltRecordTypeEnum {
DLTRECORDTYPE_UNDEFINED = 0;
DLTRECORDTYPE_CONTEXT = 1;
DLTRECORDTYPE_TOPOLOGY = 2;
DLTRECORDTYPE_DEVICE = 3;
DLTRECORDTYPE_LINK = 4;
DLTRECORDTYPE_SERVICE = 5;
DLTRECORDTYPE_SLICE = 6;
}
enum DltRecordOperationEnum {
DLTRECORDOPERATION_UNDEFINED = 0;
DLTRECORDOPERATION_ADD = 1;
DLTRECORDOPERATION_UPDATE = 2;
DLTRECORDOPERATION_DELETE = 3;
}
enum DltRecordStatusEnum {
DLTRECORDSTATUS_UNDEFINED = 0;
DLTRECORDSTATUS_SUCCEEDED = 1;
DLTRECORDSTATUS_FAILED = 2;
}
enum DltStatusEnum {
DLTSTATUS_UNDEFINED = 0;
DLTSTATUS_NOTAVAILABLE = 1;
DLTSTATUS_INITIALIZED = 2;
DLTSTATUS_AVAILABLE = 3;
DLTSTATUS_DEINIT = 4;
}
message DltRecordId {
context.Uuid domain_uuid = 1; // unique identifier of domain owning the record
DltRecordTypeEnum type = 2; // type of record
context.Uuid record_uuid = 3; // unique identifier of the record within the domain context_uuid/topology_uuid
}
message DltRecord {
DltRecordId record_id = 1; // record identifier
DltRecordOperationEnum operation = 2; // operation to be performed over the record
string data_json = 3; // record content: JSON-encoded record content
}
message DltRecordSubscription {
// retrieved events have to match ALL conditions.
// i.e., type in types requested, AND operation in operations requested
// TODO: consider adding a more sophisticated filtering
repeated DltRecordTypeEnum type = 1; // selected event types, empty=all
repeated DltRecordOperationEnum operation = 2; // selected event operations, empty=all
}
message DltRecordEvent {
context.Event event = 1; // common event data (timestamp & event_type)
DltRecordId record_id = 2; // record identifier associated with this event
}
message DltRecordStatus {
DltRecordId record_id = 1; // identifier of the associated record
DltRecordStatusEnum status = 2; // status of the record
string error_message = 3; // error message in case of failure, empty otherwise
}
message DltPeerStatus {
context.TeraFlowController controller = 1; // Identifier of the TeraFlow controller instance
DltStatusEnum status = 2; // Status of the TeraFlow controller instance
}
message DltPeerStatusList {
repeated DltPeerStatus peers = 1; // List of peers and their status
}
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
'use strict';
var grpc = require('grpc');
var dlt_service_pb = require('./dlt_service_pb.js');
var context_pb = require('./context_pb.js');
function serialize_context_Empty(arg) {
if (!(arg instanceof context_pb.Empty)) {
throw new Error('Expected argument of type context.Empty');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_context_Empty(buffer_arg) {
return context_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_context_TeraFlowController(arg) {
if (!(arg instanceof context_pb.TeraFlowController)) {
throw new Error('Expected argument of type context.TeraFlowController');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_context_TeraFlowController(buffer_arg) {
return context_pb.TeraFlowController.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltPeerStatus(arg) {
if (!(arg instanceof dlt_service_pb.DltPeerStatus)) {
throw new Error('Expected argument of type dlt.DltPeerStatus');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltPeerStatus(buffer_arg) {
return dlt_service_pb.DltPeerStatus.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltPeerStatusList(arg) {
if (!(arg instanceof dlt_service_pb.DltPeerStatusList)) {
throw new Error('Expected argument of type dlt.DltPeerStatusList');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltPeerStatusList(buffer_arg) {
return dlt_service_pb.DltPeerStatusList.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltRecord(arg) {
if (!(arg instanceof dlt_service_pb.DltRecord)) {
throw new Error('Expected argument of type dlt.DltRecord');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltRecord(buffer_arg) {
return dlt_service_pb.DltRecord.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltRecordEvent(arg) {
if (!(arg instanceof dlt_service_pb.DltRecordEvent)) {
throw new Error('Expected argument of type dlt.DltRecordEvent');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltRecordEvent(buffer_arg) {
return dlt_service_pb.DltRecordEvent.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltRecordId(arg) {
if (!(arg instanceof dlt_service_pb.DltRecordId)) {
throw new Error('Expected argument of type dlt.DltRecordId');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltRecordId(buffer_arg) {
return dlt_service_pb.DltRecordId.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltRecordStatus(arg) {
if (!(arg instanceof dlt_service_pb.DltRecordStatus)) {
throw new Error('Expected argument of type dlt.DltRecordStatus');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltRecordStatus(buffer_arg) {
return dlt_service_pb.DltRecordStatus.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_dlt_DltRecordSubscription(arg) {
if (!(arg instanceof dlt_service_pb.DltRecordSubscription)) {
throw new Error('Expected argument of type dlt.DltRecordSubscription');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_dlt_DltRecordSubscription(buffer_arg) {
return dlt_service_pb.DltRecordSubscription.deserializeBinary(new Uint8Array(buffer_arg));
}
var DltGatewayServiceService = exports.DltGatewayServiceService = {
recordToDlt: {
path: '/dlt.DltGatewayService/RecordToDlt',
requestStream: false,
responseStream: false,
requestType: dlt_service_pb.DltRecord,
responseType: dlt_service_pb.DltRecordStatus,
requestSerialize: serialize_dlt_DltRecord,
requestDeserialize: deserialize_dlt_DltRecord,
responseSerialize: serialize_dlt_DltRecordStatus,
responseDeserialize: deserialize_dlt_DltRecordStatus,
},
getFromDlt: {
path: '/dlt.DltGatewayService/GetFromDlt',
requestStream: false,
responseStream: false,
requestType: dlt_service_pb.DltRecordId,
responseType: dlt_service_pb.DltRecord,
requestSerialize: serialize_dlt_DltRecordId,
requestDeserialize: deserialize_dlt_DltRecordId,
responseSerialize: serialize_dlt_DltRecord,
responseDeserialize: deserialize_dlt_DltRecord,
},
subscribeToDlt: {
path: '/dlt.DltGatewayService/SubscribeToDlt',
requestStream: false,
responseStream: true,
requestType: dlt_service_pb.DltRecordSubscription,
responseType: dlt_service_pb.DltRecordEvent,
requestSerialize: serialize_dlt_DltRecordSubscription,
requestDeserialize: deserialize_dlt_DltRecordSubscription,
responseSerialize: serialize_dlt_DltRecordEvent,
responseDeserialize: deserialize_dlt_DltRecordEvent,
},
getDltStatus: {
path: '/dlt.DltGatewayService/GetDltStatus',
requestStream: false,
responseStream: false,
requestType: context_pb.TeraFlowController,
responseType: dlt_service_pb.DltPeerStatus,
requestSerialize: serialize_context_TeraFlowController,
requestDeserialize: deserialize_context_TeraFlowController,
responseSerialize: serialize_dlt_DltPeerStatus,
responseDeserialize: deserialize_dlt_DltPeerStatus,
},
getDltPeers: {
path: '/dlt.DltGatewayService/GetDltPeers',
requestStream: false,
responseStream: false,
requestType: context_pb.Empty,
responseType: dlt_service_pb.DltPeerStatusList,
requestSerialize: serialize_context_Empty,
requestDeserialize: deserialize_context_Empty,
responseSerialize: serialize_dlt_DltPeerStatusList,
responseDeserialize: deserialize_dlt_DltPeerStatusList,
},
};
exports.DltGatewayServiceClient = grpc.makeGenericClientConstructor(DltGatewayServiceService);
This diff is collapsed.
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const path = require('path');
......@@ -5,7 +20,7 @@ const { connectToNetwork } = require('../dist/fabricConnect');
const utf8Decoder = new TextDecoder();
// Load the protocol buffer definitions
const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_service.proto');
const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_gateway.proto');
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
keepCase: true,
longs: String,
......
/*
*
* SPDX-License-Identifier: Apache-2.0
*/
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as grpc from '@grpc/grpc-js';
import { connect, Contract, Identity, Signer, signers, Network, CloseableAsyncIterable, ChaincodeEvent, GatewayError } from '@hyperledger/fabric-gateway';
......
node_modules/
\ No newline at end of file
{
"name": "adrenalineDLT_APP",
"version": "1.0.0",
"description": "A DLT application that record and manages topology data as JSON implemented in typeScript using fabric-gateway",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"engines": {
"node": ">=18"
},
"scripts": {
"build": "tsc",
"build:watch": "tsc -w",
"lint": "eslint . --ext .ts",
"prepare": "npm run build",
"pretest": "npm run lint",
"start": "node dist/adrenalineDLT_app.js"
},
"engineStrict": true,
"author": "CTTC-Javier",
"license": "Apache-2.0",
"dependencies": {
"@grpc/grpc-js": "^1.9.7",
"@hyperledger/fabric-gateway": "~1.4.0",
"dotenv": "^16.4.5"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
"@types/node": "^18.18.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"typescript": "~5.2.2"
}
}
{
"extends":"@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "dist",
"declaration": true,
"sourceMap": true,
"noImplicitAny": true
},
"include": [
"./src/**/*"
],
"exclude": [
"./src/**/*.spec.ts"
]
}
\ No newline at end of file
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const { connectToNetwork } = require('../dist/fabricConnect');
const fsp = require('fs').promises;
const fs = require('fs');
......
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const { connectToNetwork } = require('../dist/fabricConnect');
const fs = require('fs');
const util = require('util');
......
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const { connectToNetwork } = require('../dist/fabricConnect');
const fs = require('fs');
const util = require('util');
......
// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const path = require('path');
const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_service.proto');
const PROTO_PATH = path.resolve(__dirname, '../proto/dlt_gateway.proto');
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
keepCase: true,
longs: String,
......
......@@ -10,7 +10,7 @@
},
"include": [
"./src/**/*"
, "src.old/grpcClient.js", "src.old/grpcServer.js" ],
, "src.old/grpcClient.js", "src.old/grpcServer.js", "tests/testEvents.js", "tests/testGateway.js" ],
"exclude": [
"./src/**/*.spec.ts"
]
......
This diff is collapsed.
This diff is collapsed.