Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deviceProfile json bug #2143

Merged
merged 2 commits into from
Sep 8, 2020
Merged

fix deviceProfile json bug #2143

merged 2 commits into from
Sep 8, 2020

Conversation

jidalong
Copy link
Member

@jidalong jidalong commented Sep 8, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
Once a device is created for the edge node, deviceController may create a device configMap for this edge node. Then we can monut this configmap to mapper container。 In my knowledge, the deviceProfile.json file is an example for modbus device configmap, but the in the kubeedge code,the filed of protocol config in configmap is named protocol_config not protocolConfig. And the mapper also use the protocol_config not protocolConfig to prase the dpl json.
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@kubeedge-bot
Copy link
Collaborator

Welcome @jidalong! It looks like this is your first PR to kubeedge/kubeedge 🎉

@kubeedge-bot kubeedge-bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 8, 2020
@kubeedge-bot kubeedge-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 8, 2020
@fisherxu
Copy link
Member

fisherxu commented Sep 8, 2020

@jidalong Thanks for the fixing! I think we shoud modify all protocol_config to protocolConfig? cc @luogangyi

@luogangyi
Copy link
Member

I am sure it is protocolConfig after KubeEdge v1.4
see configmap I get from in running env

{
	"deviceInstances": [{
		"id": "sensor-tag-instance-customized-02",
		"name": "sensor-tag-instance-customized-02",
		"protocol": "modbus-sensor-tag-instance-customized-02",
		"model": "sensor-tag-model",
		"twins": [{
			"propertyName": "temperature-enable",
			"desired": {
				"value": "OFF",
				"metadata": {
					"timestamp": "1550049403598",
					"type": "string"
				}
			},
			"reported": {
				"value": "OFF",
				"metadata": {
					"timestamp": "1550049403598",
					"type": "string"
				}
			}
		}],
		"propertyVisitors": [{
			"name": "temperature",
			"propertyName": "temperature",
			"modelName": "sensor-tag-model",
			"protocol": "modbus",
			"reportCycle": 1000000000,
			"collectCycle": 500000000,
			"customizedValues": {
				"def1": "def1-val",
				"def2": "def2-val",
				"def3": {
					"innerDef1": "idef-val"
				}
			},
			"visitorConfig": {
				"register": "DiscreteInputRegister",
				"offset": 1,
				"limit": 2,
				"scale": 1,
				"isSwap": true,
				"isRegisterSwap": true
			}
		}, {
			"name": "temperature-enable",
			"propertyName": "temperature-enable",
			"modelName": "sensor-tag-model",
			"protocol": "modbus",
			"visitorConfig": {
				"register": "DiscreteInputRegister",
				"offset": 3,
				"limit": 1,
				"scale": 1,
				"isSwap": true,
				"isRegisterSwap": true
			}
		}]
	}],
	"deviceModels": [{
		"name": "sensor-tag-model",
		"properties": [{
			"name": "temperature",
			"dataType": "int",
			"description": "temperature in degree celsius",
			"accessMode": "ReadWrite",
			"defaultValue": 0,
			"maximum": 100,
			"unit": "degree celsius"
		}, {
			"name": "temperature-enable",
			"dataType": "string",
			"description": "enable data collection of temperature sensor",
			"accessMode": "ReadWrite",
			"defaultValue": "OFF"
		}, {
			"name": "pressure",
			"dataType": "int",
			"description": "pressure in degree celsius",
			"accessMode": "ReadWrite",
			"defaultValue": 0,
			"maximum": 100,
			"unit": "Pa"
		}]
	}],
	"protocols": [{
		"name": "modbus-sensor-tag-instance-customized-02",
		"protocol": "modbus",
		"protocolConfig": {
			"slaveID": 1
		},
		"protocolCommonConfig": {
			"com": {
				"serialPort": "1",
				"baudRate": 115200,
				"dataBits": 8,
				"parity": "even",
				"stopBits": 1
			},
			"customizedValues": {
				"pdef1": "pdef1-val",
				"pdef2": "pdef2-val"
			}
		}
	}]
}

@fisherxu
Copy link
Member

fisherxu commented Sep 8, 2020

I am sure it is protocolConfig after KubeEdge v1.4
see configmap I get from in running env

Okey, so please modify all protocol_config to protocolConfig in modbus mapper.

@jidalong
Copy link
Member Author

jidalong commented Sep 8, 2020

I am sure it is protocolConfig after KubeEdge v1.4
see configmap I get from in running env

Okey, so please modify all protocol_config to protocolConfig in modbus mapper.
Okey, got it. I will modify all protocol_config to protocolConfig in modbus mapper.

@kubeedge-bot kubeedge-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 8, 2020
@kubeedge-bot kubeedge-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 8, 2020
@fisherxu
Copy link
Member

fisherxu commented Sep 8, 2020

/lgtm

@kubeedge-bot kubeedge-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2020
@fisherxu
Copy link
Member

fisherxu commented Sep 8, 2020

/approve

@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fisherxu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2020
@kubeedge-bot kubeedge-bot merged commit fed6592 into kubeedge:master Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants