feat(frontend): cwmp remote messages | closes #266

This commit is contained in:
leandrofars 2024-06-11 22:20:46 -03:00
parent 688b17eca5
commit 1879a6cd0b

View File

@ -38,15 +38,18 @@ const [answer, setAnswer] = useState(false)
const [content, setContent] = useState('') const [content, setContent] = useState('')
const [age, setAge] = useState(2); const [age, setAge] = useState(2);
const [value, setValue] = useState(`{ const [value, setValue] = useState(`<?xml version="1.0" encoding="UTF-8"?>
"param_paths": [ <soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="urn:dslforum-org:cwmp-1-0 ..\schemas\wt121.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"Device.WiFi.SSID.[Name==wlan0].", <soap:Header/>
"Device.IP.Interface.*.Alias", <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
"Device.DeviceInfo.FirmwareImage.*.Alias", <cwmp:GetParameterValues>
"Device.IP.Interface.1.IPv4Address.1.IPAddress" <ParameterNames>
], <string>InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.</string>
"max_depth": 2 <string>InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.</string>
}`) </ParameterNames>
</cwmp:GetParameterValues>
</soap:Body>
</soap:Envelope>`)
const handleClose = () => { const handleClose = () => {
setOpen(false); setOpen(false);
@ -103,58 +106,66 @@ const handleOpen = () => {
setAge(event.target.value); setAge(event.target.value);
switch(event.target.value) { switch(event.target.value) {
case 1: case 1:
setValue(`{ setValue(`<?xml version="1.0" encoding="UTF-8"?>
"allow_partial": true, <soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="urn:dslforum-org:cwmp-1-0 ..\schemas\wt121.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"create_objs": [ <soap:Header/>
{ <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
"obj_path": "Device.IP.Interface.", <cwmp:AddObject>
"param_settings": [ <ObjectName>InternetGatewayDevice.LANDevice.</ObjectName>
{ <ParameterKey></ParameterKey>
"param": "Alias", </cwmp:AddObject>
"value": "test", </soap:Body>
"required": true </soap:Envelope>`)
}
]
}
]
}`)
break; break;
case 2: case 2:
setValue(`{ setValue(`<?xml version="1.0" encoding="UTF-8"?>
"param_paths": [ <soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="urn:dslforum-org:cwmp-1-0 ..\schemas\wt121.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"Device.WiFi.SSID.[Name==wlan0].", <soap:Header/>
"Device.IP.Interface.*.Alias", <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
"Device.DeviceInfo.FirmwareImage.*.Alias", <cwmp:GetParameterValues>
"Device.IP.Interface.1.IPv4Address.1.IPAddress" <ParameterNames>
], <string>InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.</string>
"max_depth": 2 <string>InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.</string>
}`) <string>InternetGatewayDevice.LANDevice.2.WLANConfiguration.2.</string>
<string>InternetGatewayDevice.LANDevice.2.WLANConfiguration.1.</string>
</ParameterNames>
</cwmp:GetParameterValues>
</soap:Body>
</soap:Envelope>`)
break; break;
case 3: case 3:
setValue(` setValue(`
{ <?xml version="1.0" encoding="UTF-8"?>
"allow_partial":true, <soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="urn:dslforum-org:cwmp-1-0 ..\schemas\wt121.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"update_objs":[ <soap:Header/>
{ <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
"obj_path":"Device.IP.Interface.[Alias==pamonha].", <cwmp:SetParameterValues>
"param_settings":[ <ParameterList soapenc:arrayType="cwmp:ParameterValueStruct[3]">
{ <ParameterValueStruct>
"param":"Alias", <Name>InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable</Name>
"value":"goiaba", <Value>0</Value>
"required":true </ParameterValueStruct>
} <ParameterValueStruct>
] <Name>InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.SSID</Name>
} <Value>HUAWEI_TEST-2</Value>
] </ParameterValueStruct>
}`) </ParameterList>
<ParameterKey>LC1309123</ParameterKey>
</cwmp:SetParameterValues>
</soap:Body>
</soap:Envelope>`)
break; break;
case 4: case 4:
setValue(`{ setValue(`<?xml version="1.0" encoding="UTF-8"?>
"allow_partial": true, <soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="urn:dslforum-org:cwmp-1-0 ..\schemas\wt121.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"obj_paths": [ <soap:Header/>
"Device.IP.Interface.3." <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
] <cwmp:DeleteObject>
}`) <ObjectName>InternetGatewayDevice.LANDevice.3.</ObjectName>
<ParameterKey></ParameterKey>
</cwmp:DeleteObject>
</soap:Body>
</soap:Envelope>`)
break; break;
default: default:
// code block // code block
@ -207,7 +218,7 @@ const handleOpen = () => {
onChange={handleChange} onChange={handleChange}
value={value} value={value}
fullWidth fullWidth
rows="9" rows="15"
/> />
</Stack> </Stack>
</CardContent> </CardContent>