Composer Identity request errors - identity

i am getting an error on the
composer identity request -c PeerAdmin#byfn-network-org1 -u admin -s adminpw -d alice
Error: failed to request identity. Error trying to enroll user and return certificates. Error: Calling enrollment endpoint failed with error [Error: connect ETIMEDOUT 192.168.1.159:7054]
Command failed
I am using the following
hyperledger fabric 1.2
composer v0.20
the ip address of my ca container is 172.19.0.4
so why is it that the error say Error: connect ETIMEDOUT 192.168.1.159:7054]
i have already verified (and verified) all the ca certs and the tls certs for all peers are copied correctly in the byfn-network-org1.json .
Also, the TLS is enabled in the docker-composer-cli.yaml
here is a copy of the connection profile.
cat ./org1/*json
{
"name": "byfn-network",
"x-type": "hlfv1",
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "1200",
"eventHub": "1200",
"eventReg": "1200"
},
"orderer": "1200"
}
}
},
"channels": {
"mychannel": {
"orderers": [
"orderer.example.com"
],
"peers": {
"peer0.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer1.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer0.org2.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer1.org2.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com",
"peer1.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
},
"Org2": {
"mspid": "Org2MSP",
"peers": [
"peer0.org2.example.com",
"peer1.org2.example.com"
],
"certificateAuthorities": [
"ca.org2.example.com"
]
}
},
"orderers": {
"orderer.example.com": {
"url": "grpcs://localhost:7050",
"grpcOptions": {
"ssl-target-name-override": "orderer.example.com"
},
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICNjCCAdygAwIBAgIRAObpbDwgoENq9ae9xt2Y7iMwCgYIKoZIzj0EAwIwbDEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l\neGFtcGxlLmNvbTAeFw0xODA4MTYwMTI3MTRaFw0yODA4MTMwMTI3MTRaMGwxCzAJ\nBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh\nbmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh\nbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQVSKzVu9jhELWQ83zU\nR2FoiYvVDfIPtoFRgWkwe08DTYH8hbav5IQm2BW9cKpZ681weJCvY40TVO/gwk7H\nk64ho18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB\nAf8EBTADAQH/MCkGA1UdDgQiBCB4ezOoLazLorKZVaP13YOZtzxObPgXiPkQElmG\nsuJZWDAKBggqhkjOPQQDAgNIADBFAiEArtkBLDF23yKQ+uiC3dPQr3AQjyLDCXn6\nKmGQpnt/S8cCIBj0tQUH6eC4A9O9ESq2bg+z2aTz3KIU8iekQVJVw+gK\n-----END CERTIFICATE-----\n"
}
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpcs://localhost.com:7051",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
},
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICSjCCAfCgAwIBAgIRAJXaYLgBAwxVBW9CaV+CgyMwCgYIKoZIzj0EAwIwdjEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs\nc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwODE2MDEyNzE0WhcNMjgwODEzMDEy\nNzE0WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE\nBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G\nA1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49\nAwEHA0IABJVVanFTaisufMlNtKJt/hcvFE2aB+3gY0P+3HX+1ePIlbmwh9P4pDhN\ndc+mX7g//gKVV+R7NQnDVdn4mdEasX6jXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV\nHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEINdm7BDMYTV9\nRWcVHpgv7ghZ7OWj20Mes6Lie+himHw0MAoGCCqGSM49BAMCA0gAMEUCIQDXf1nh\nIvTzP+qwFnHa8iRvJz72NR8hO0FEKjf78yovYgIgerLVhjW5ayyFy4alXUrGL+oO\n5UrDMBF6mWjEpLHiP3k=\n-----END CERTIFICATE-----\n"
}
},
"peer1.org1.example.com": {
"url": "grpcs://peer1.org1.example.com:8051",
"grpcOptions": {
"ssl-target-name-override": "peer1.org1.example.com"
},
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICSjCCAfCgAwIBAgIRAJXaYLgBAwxVBW9CaV+CgyMwCgYIKoZIzj0EAwIwdjEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs\nc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwODE2MDEyNzE0WhcNMjgwODEzMDEy\nNzE0WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE\nBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G\nA1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49\nAwEHA0IABJVVanFTaisufMlNtKJt/hcvFE2aB+3gY0P+3HX+1ePIlbmwh9P4pDhN\ndc+mX7g//gKVV+R7NQnDVdn4mdEasX6jXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV\nHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEINdm7BDMYTV9\nRWcVHpgv7ghZ7OWj20Mes6Lie+himHw0MAoGCCqGSM49BAMCA0gAMEUCIQDXf1nh\nIvTzP+qwFnHa8iRvJz72NR8hO0FEKjf78yovYgIgerLVhjW5ayyFy4alXUrGL+oO\n5UrDMBF6mWjEpLHiP3k=\n-----END CERTIFICATE-----\n"
}
},
"peer0.org2.example.com": {
"url": "grpcs://localhost.com:9051",
"grpcOptions": {
"ssl-target-name-override": "peer0.org2.example.com"
},
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICSjCCAfCgAwIBAgIRAMZ3rMvIJP+ebMYvxTsrqEswCgYIKoZIzj0EAwIwdjEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs\nc2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTgwODE2MDEyNzE0WhcNMjgwODEzMDEy\nNzE0WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE\nBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G\nA1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49\nAwEHA0IABD9NNQrngFbpYV7CqOMk1yDcVqo5wl4XBiSQ9vVCEcFa5kTRUYX5zJcb\nsp9o0CCyDHOyY3aq9RDUnwyP+0W00qCjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV\nHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIGqaM0oY+4bk\nMAyHivCN12AAq/52PnpO4cUvQCSSy1XZMAoGCCqGSM49BAMCA0gAMEUCIQCsMWyw\nz/k9prAf043Kv/de0/avLm7EXvNDx1kaXQc9CwIgYuuCxvz8z1BdV7Ib/+knTcnX\n9qkKVLGC/L/opKL/mYM=\n-----END CERTIFICATE-----\n"
}
},
"peer1.org2.example.com": {
"url": "grpcs://localhost.com:10051",
"grpcOptions": {
"ssl-target-name-override": "peer1.org2.example.com"
},
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICSjCCAfCgAwIBAgIRAMZ3rMvIJP+ebMYvxTsrqEswCgYIKoZIzj0EAwIwdjEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs\nc2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTgwODE2MDEyNzE0WhcNMjgwODEzMDEy\nNzE0WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE\nBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G\nA1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49\nAwEHA0IABD9NNQrngFbpYV7CqOMk1yDcVqo5wl4XBiSQ9vVCEcFa5kTRUYX5zJcb\nsp9o0CCyDHOyY3aq9RDUnwyP+0W00qCjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV\nHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIGqaM0oY+4bk\nMAyHivCN12AAq/52PnpO4cUvQCSSy1XZMAoGCCqGSM49BAMCA0gAMEUCIQCsMWyw\nz/k9prAf043Kv/de0/avLm7EXvNDx1kaXQc9CwIgYuuCxvz8z1BdV7Ib/+knTcnX\n9qkKVLGC/L/opKL/mYM=\n-----END CERTIFICATE-----\n"
}
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "https://localhost:7054",
"caName": "ca-org1"
},
"ca.org2.example.com": {
"url": "https://localhost:8054",
"caName": "ca-org2"
}
}
}

Related

How to remove window.chrome in headful puppeteer?

When I launch headful puppeteer,there always is chrome property in window.
window.chrome like
{
"app": {
"isInstalled": false,
"InstallState": {
"DISABLED": "disabled",
"INSTALLED": "installed",
"NOT_INSTALLED": "not_installed"
},
"RunningState": {
"CANNOT_RUN": "cannot_run",
"READY_TO_RUN": "ready_to_run",
"RUNNING": "running"
}
},
"runtime": {
"OnInstalledReason": {
"CHROME_UPDATE": "chrome_update",
"INSTALL": "install",
"SHARED_MODULE_UPDATE": "shared_module_update",
"UPDATE": "update"
},
"OnRestartRequiredReason": {
"APP_UPDATE": "app_update",
"OS_UPDATE": "os_update",
"PERIODIC": "periodic"
},
"PlatformArch": {
"ARM": "arm",
"ARM64": "arm64",
"MIPS": "mips",
"MIPS64": "mips64",
"X86_32": "x86-32",
"X86_64": "x86-64"
},
"PlatformNaclArch": {
"ARM": "arm",
"MIPS": "mips",
"MIPS64": "mips64",
"X86_32": "x86-32",
"X86_64": "x86-64"
},
"PlatformOs": {
"ANDROID": "android",
"CROS": "cros",
"LINUX": "linux",
"MAC": "mac",
"OPENBSD": "openbsd",
"WIN": "win"
},
"RequestUpdateCheckStatus": {
"NO_UPDATE": "no_update",
"THROTTLED": "throttled",
"UPDATE_AVAILABLE": "update_available"
}
}
}
I tried delete window.chrome but didn't work.

Geeting error in adding ssl certificate in cloudfront using cloudformation (needs to be specified)

{
"AWSTemplateFormatVersion" : "2010-09-09",
"Parameters": {
"AlternateDomainNames": {
"Description": "CNAMEs (alternate domain names), if any, for the distribution. Example. test.codavel.com",
"Type": "String",
"Default": "test.example.com"
}
},
"Resources" : {
"myDistribution" : {
"Type" : "AWS::CloudFront::Distribution",
"Properties" : {
"DistributionConfig" : {
"Origins" : [ {
"DomainName" : "ELBfor-1234.region.elb.amazonaws.com",
"Id" : "myCustomOrigin",
"CustomOriginConfig" : {
"HTTPPort" : "80",
"HTTPSPort" : "443",
"OriginProtocolPolicy" : "match-viewer",
"OriginSSLProtocols" : [
"TLSv1",
"TLSv1.1",
"TLSv1.2",
"SSLv3"
]
}
} ],
"HttpVersion": "http2",
"Aliases": [
{
"Ref": "AlternateDomainNames"
}
],
"Enabled" : "true",
"Comment" : "example-cdn",
"DefaultCacheBehavior" : {
"TargetOriginId" : "myCustomOrigin",
"SmoothStreaming" : "false",
"AllowedMethods": [
"HEAD",
"GET",
"OPTIONS"
],
"MaxTTL": "31536000",
"MinTTL": "0",
"Compress" : "true",
"ForwardedValues" : {
"QueryString" : "false",
"Cookies" : { "Forward" : "all" }
},
"ViewerProtocolPolicy" : "allow-all"
},
"PriceClass" : "PriceClass_All",
"Restrictions" : {
"GeoRestriction": {
"RestrictionType": "none",
"Locations": []
}
},
"ViewerCertificate": {
"SslSupportMethod": "sni-only",
"AcmCertificateArn" : {
"Fn::Sub": "arn:aws:acm:us-east-1:<ID>:certificate/2345f-534234"
}
}
}
}
}
}
}
Hi Team,
I am using this in my cloudfront template to add my custom SSL on that and it is showing me some an error:- Exactly one of [AcmCertificateArn,CloudFrontDefaultCertificate,IamCertificateId] needs to be specified.
So please let me know how will i add this or if there is any option to add in parameter so that it will list that certificate. Please guide me for the same. This is my certificate ARN - arn:aws:acm:us-east-1::certificate/2345f-534234
ViewerCertificate block should look like this in your case:
"ViewerCertificate": {
"SslSupportMethod": "sni-only",
"AcmCertificateArn": " arn:aws:acm:us-east-1::certificate/2345f-534234"
}
Also what you should always take care is that certificate is provisioned in us-east1 region (yours is, based on the ARN :)
The property you need to use is ViewerCertificate. The configuration within the CloudFormation documentation should help you identify any options you might want to add.
You can add a parameter if you would like to specify the ACM certificate, the type will be a string.
Below is an updated template. You will need to ensure th ACM certificate includes your account id. I have ran this to validate that it builds successfully.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"AlternateDomainNames": {
"Description": "CNAMEs (alternate domain names), if any, for the distribution. Example. test.codavel.com",
"Type": "String",
"Default": "test.example.com"
}
},
"Resources": {
"myDistribution": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"Origins": [{
"DomainName": "ELBfor-1234.region.elb.amazonaws.com",
"Id": "myCustomOrigin",
"CustomOriginConfig": {
"HTTPPort": "80",
"HTTPSPort": "443",
"OriginProtocolPolicy": "match-viewer",
"OriginSSLProtocols": [
"TLSv1",
"TLSv1.1",
"TLSv1.2",
"SSLv3"
]
}
}],
"ViewerCertificate": {
"SslSupportMethod": "sni-only",
"AcmCertificateArn": "arn:aws:acm:us-east-1::certificate/2345f-534234"
},
"HttpVersion": "http2",
"Aliases": [{
"Ref": "AlternateDomainNames"
}],
"Enabled": "true",
"Comment": "example-cdn",
"DefaultCacheBehavior": {
"TargetOriginId": "myCustomOrigin",
"SmoothStreaming": "false",
"AllowedMethods": [
"HEAD",
"GET",
"OPTIONS"
],
"MaxTTL": "31536000",
"MinTTL": "0",
"Compress": "true",
"ForwardedValues": {
"QueryString": "false",
"Cookies": {
"Forward": "all"
}
},
"ViewerProtocolPolicy": "allow-all"
},
"PriceClass": "PriceClass_All",
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Locations": []
}
}
}
}
}
}
}

Set next step for the waterfall dialogue in Microsoft BotBuilder NodeJS SDK

I am using Microsoft Bot Framework for my facebook messenger bot. I want to load the dialog data from json files instead of hard coding in the js file. I would like to configure the next step in the dialog, based on result from the "current" step, which is part of the json file configuration, something like this.
{
"name": "welcome",
"type": "waterfall",
"steps": [
{
"id": 0,
"data": [
{
"type": "text",
"value": "Hey, It's nice to meet you."
},
{
"type": "quickReplies",
"value": "What do you want to do next?",
"options": [
{
"text": "some option 1",
"value": "option1"
},
{
"text": "some option 2",
"value": "option2"
}
]
}
],
"next": [
{
"result": "option1",
"action": "goto step 2"
},
{
"result": "option2",
"action": "goto step 5"
}
]
}
]
}
I would like to process all the incoming messages and respond with correct dialog or correct step in the dialog for the user.
I am trying something like this;
handleMessage = function (session) {
var step = session.dialogData["BotBuilder.Data.WaterfallStep"] || 0;
// check response data from previou step and identify the next step.
// set the waterfall step id
session.dialogData["BotBuilder.Data.WaterfallStep"] = 2;
session.send("Hello");
}
var bot = new builder.UniversalBot(connector, function (session) {
handleMessage(session);
})
.set('storage',tableStorage);
With this code, I am always getting step as zero for session.dialogData["BotBuilder.Data.WaterfallStep"] even after setting this to a different number.
Also, as soon as I set the waterfall step number, all other state data that is stored in my table storage for this conversation is gone.
Storage data before setting waterfall step:
{
"BotBuilder.Data.SessionState": {
"callstack": [
{
"id": "*:/",
"state": {
"BotBuilder.Data.WaterfallStep": 0
}
},
{
"id": "*:welcome",
"state": {
"BotBuilder.Data.WaterfallStep": 1
}
},
{
"id": "BotBuilder:prompt-text",
"state": {
"options": {
"prompt": {
"type": "message",
"agent": "botbuilder",
"source": "facebook",
"address": {
"id": "mid.$cAAAlr-0LRH9niO21L1hV6hs83GuJ",
"channelId": "facebook",
"user": {
"id": "XXXX",
"name": "XXXX"
},
"conversation": {
"isGroup": false,
"id": "XX"
},
"bot": {
"id": "XXX",
"name": "XXX"
},
"serviceUrl": "https://facebook.botframework.com"
},
"text": "what do you want to next"
//ignored for simplicity
},
"promptAfterAction": true,
"libraryNamespace": "*"
},
"turns": 0,
"lastTurn": 1517594116372,
"isReprompt": false
}
}
],
"lastAccess": 1517594112740,
"version": 0
}
}
After I set the waterfall step:
{
"BotBuilder.Data.SessionState": {
"callstack": [
{
"id": "*:/",
"state": {
"BotBuilder.Data.WaterfallStep": 2
}
}
],
"lastAccess": 1517602122416,
"version": 0
}
}
Interestingly the step number is saved to the database (but in session state) but my "session" variable do not have this value anywhere. Also, even after configuring custom state service, the serviceUrl is still https://facebook.botframework.com which I thought is the default state service used if there is no state service set for the bot.
Per your code, as your bot actually contains only one waterfall step: handleMessage(session);, which raised your issue. You can consider to create multiple dialogs from json configration instead of complex waterfall steps.
Here is my quick test, for your information:
const json = `
[{
"name": "welcome",
"type": "waterfall",
"steps": [
{
"id": 0,
"data": [
{
"type": "text",
"value": "Hey, It's nice to meet you."
},
{
"type": "quickReplies",
"value": "What do you want to do next?",
"options": [
{
"text": "some option 1",
"value": "option1"
},
{
"text": "some option 2",
"value": "option2"
}
]
}
],
"next": [
{
"result": "option1",
"action": "dialog2"
},
{
"result": "option2",
"action": "dialog3"
}
]
}
]
},{
"name":"dialog2",
"type": "waterfall",
"steps": [
{
"data": [
{
"type": "text",
"value": "Hey, this is dialig2."
}]
}
]
},{
"name":"dialog3",
"type": "waterfall",
"steps": [
{
"data": [
{
"type": "text",
"value": "Hey, this is dialig3."
}]
}
]
}]
`;
const generateSignleStep = (step) => {
return (session, args, next) => {
step.forEach(sentence => {
switch (sentence.type) {
case 'quickReplies':
let choices = sentence.options.map(item => {
return item.value
});
let card = new builder.ThumbnailCard(session)
.text(sentence.value)
.buttons(sentence.options.map(choice => new builder.CardAction.imBack(session, choice.value, choice.text)))
let message = new builder.Message(session).addAttachment(card);
builder.Prompts.choice(session, message, choices);
break;
case 'text':
default:
session.send(sentence.value)
break;
}
})
}
}
const generatenextAction = (actions) => {
return (session, args, next) => {
const response = args.response;
actions.map(action => {
if (action.result == response.entity) {
session.beginDialog(action.action);
}
})
}
}
const generateWaterfallSteps = (steps) => {
let waterfall = [];
steps.forEach(step => {
waterfall.push(generateSignleStep(step.data));
if (step.next) {
waterfall.push(generatenextAction(step.next));
}
});
return waterfall;
}
var bot = new builder.UniversalBot(connector);
const jsonobj = JSON.parse(json);
jsonobj.forEach(dialog => {
bot.dialog(dialog.name, generateWaterfallSteps(dialog.steps))
.triggerAction({
matches: new RegExp(dialog.name, "g")
})
});
The result is:

OpendayLight: How to specify the destination IP address of the flow table

I'm using OpendayLight(Carbon SR1) to send a flow table to the switch, everything is OK except working with the set-nw-dst-action-case instruction. Once I use this instruction, the flow can not be set to switch correctly(check via http://opendaylight_ip:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0)
and this is my json code to set the flow:
{
"flow": [
{
"id": "test",
"match": {
"ethernet-match": {
"ethernet-destination": {
"address": "02:42:4a:46:fc:02"
}
}
},
"instructions": {
"instruction": [
{
"order": "0",
"apply-actions": {
"action": [
{
"order": "0",
"set-nw-dst-action": {
"_Opps": "Remove this action goes normal"
"ipv4-address": "192.168.1.3/32"
}
},
{
"order": "1",
"set-dl-dst-action": {
"address": "02:42:4a:46:fc:03"
}
},
{
"order": "2",
"output-action": {
"output-node-connector": "3",
"max-length": "65535"
}
}
]
}
}
]
},
"priority": "16",
"table_id": "0"
}
]
}
The json code above follows the OpendayLight specification, but I found this message in Open vSwitch logs:
2017-09-07T16:35:26.713Z|00103|ofp_actions|WARN|set_field ip_dst lacks correct prerequisities
This question is similar to my one. I have tried to add flow with ovs-ofctl tools and succeed, is there any way to add the flow with set-nw-dst-action-case instruction in OpendayLight?
p.s. The ovs-ofctl command let:
ovs-ofctl add-flow s1 "table=0,dl_dst=02:42:4a:46:fc:02,priority=12,action=mod_dl_dst:02:42:4a:46:fc:03,mod_nw_dst:192.168.1.3,output:3"
EDIT(2017-9-8 21:14 GMT+8)
I have tried to match the ip criteria and the ovs log complain about this:
2017-09-08T12:49:30.567Z|00032|nx_match|WARN|Rejecting NXM/OXM entry 0:32768:12:1:8 with 1-bits in value for bits wildcarded by the mask.
2017-09-08T12:49:30.567Z|00033|ofp_actions|WARN|bad action at offset 0 (OFPBMC_BAD_WILDCARDS):
00000000 00 19 00 10 80 00 19 08-0a 00 00 03 ff 00 00 00
2017-09-08T12:49:30.567Z|00034|connmgr|INFO|s1<->tcp:192.168.43.171:6633: sending OFPBMC_BAD_WILDCARDS error reply to OFPT_FLOW_MOD message
2017-09-08T12:49:30.567Z|00035|ofp_actions|WARN|set_field ip_dst lacks correct prerequisities
and I use this json code(OpendayLight Yang UI passed):
{
"flow": [
{
"id": "bwt",
"match": {
"ethernet-match": {
"ethernet-destination": {
"address": "02:42:4a:46:fc:02"
}
},
"ipv4-destination": "192.168.1.2/32"
},
"instructions": {
"instruction": [
{
"order": "0",
"apply-actions": {
"action": [
{
"order": "0",
"set-dl-dst-action": {
"address": "02:42:4a:46:fc:03"
}
},
{
"order": "1",
"set-nw-src-action": {
"ipv4-address": "192.168.1.3/32"
}
},
{
"order": "2",
"output-action": {
"output-node-connector": "3",
"max-length": "65535"
}
}
]
}
}
]
},
"priority": "12",
"table_id": "0"
}
]
}
EDIT(2017-9-9 23:48 GMT+8)
The problem has been solved, see my answer.
Checkout openflow spec section 7.2.3.8, table:13(OXM_OF_IPV4_DST), as also error described in ovs log, you need to match packet type of ipv4 before setting action destination ip.
Sample Flow
ovs-ofctl add-flow s1 -O OpenFlow13 "table=0,ip,dl_dst=02:42:4a:46:fc:02,priority=12,action=set_field:02:42:4a:46:fc:03->eth_dst,set_field:192.168.1.3->ip_dst,output:3"
Specification
According to OpenFlow Switch Specification Version 1.3.5 ( Protocol version 0x04 ) section 7.2.3.6 Flow Match Field Prerequisite and section 7.2.3.8 Header Match Fields, the flow to modify the ip address(dst_ip or src_ip) have to:
1. set ethernet-destination-mask to ff:ff:ff:ff:ff:ff
2. ethernet-type-type to 0x0800.
3. The mask of ipv4 should be 255.255.255.255 or ip_addr/32
Code
The effective flow json code in OpendayLight platform as follows(Carbon SR1, opendaylight-inventory rev.2013-08-19):
{
"flow": [
{
"id": "bwt",
"match": {
"ethernet-match": {
"ethernet-destination": {
"address": "02:42:4a:46:fc:01",
"mask": "ff:ff:ff:ff:ff:ff"
},
"ethernet-type": {
"type": "0x0800"
}
},
"ipv4-destination": "192.168.1.2/32"
},
"instructions": {
"instruction": [
{
"order": "0",
"apply-actions": {
"action": [
{
"order": "0",
"set-dl-dst-action": {
"address": "02:42:4a:46:fc:03"
}
},
{
"order": "1",
"set-nw-dst-action": {
"ipv4-address": "192.168.1.3/32"
}
},
{
"order": "2",
"output-action": {
"output-node-connector": "3",
"max-length": "65535"
}
}
]
}
}
]
},
"priority": "12",
"table_id": "0"
}
]
}
Acknowledgment
Thanks to Karthik Prasad who guides me to read the specification and Peder Zickler who met the same problem as me.

Autofac Configuration for constructor with KeyFilter attribute

I am trying to use Autofac Configuration to create a Service object.
public class Service : IService
{
public Service([KeyFilter("eod")]ISimpleMongoClient eodClient,
[KeyFilter("live")]ISimpleMongoClient liveClient
) : base(config)
{
_eodClient = eodClient;
_liveClient = liveClient;
}
}
public class SimpleMongoClient : ISimpleMongoClient
{
public SimpleMongoClient(string connectionString, string database)
{
IMongoClient client = new MongoClient(connectionString);
MongoDatabase = client.GetDatabase(database);
}
}
Somehow with the following configuration, it is not able to resolve the ISimpleMongoClient parameters correctly. What else am I missing?
{
"components": [
{
"type": "Service, TestProject",
"services": [
{
"type": "IService, TestProject"
}
],
"instanceScope": "single-instance"
},
{
"type": "SimpleMongoClient, TestProject",
"services": [
{
"type": "ISimpleMongoClient, TestProject",
"key": "eod"
}
],
"parameters": {
"connectionString": "mongodb://localhost:27017/?readPreference=primary",
"database": "eod"
},
"instanceScope": "single-instance"
},
{
"type": "SimpleMongoClient, TestProject",
"services": [
{
"type": "ISimpleMongoClient, TestProject",
"key": "live"
}
],
"parameters": {
"connectionString": "mongodb://localhost:27017/?readPreference=primary",
"database": "live"
},
"instanceScope": "single-instance"
}
]
}
To use the KeyFilter attribute you need to register the thing doing the filtering with the WithAttributeFiltering() extension. You can't do that through configuration.