sdcio / docs

Documentation for Schema Driven Configuration
Apache License 2.0
18 stars 4 forks source link

Error Applying Juniper Router Config #59

Closed infinitydon closed 4 months ago

infinitydon commented 4 months ago

Hi,

Just starting with netconf, I tried to configure an interface for a Juniper router using the following manifests:

apiVersion: inv.sdcio.dev/v1alpha1
kind: Schema
metadata:
  name: mx.juniper.23.2r1
  namespace: default
spec:
  repoURL: https://github.com/Juniper/yang
  provider: mx.juniper.sdcio.dev
  version: 23.2R1
  kind: branch
  ref: master
  dirs:
  - src: 23.2/23.2R1/junos/conf
    dst: junos
  - src: 23.2/23.2R1/common
    dst: common
  schema:
    models:
    - junos
    includes:
    - common
---
apiVersion: inv.sdcio.dev/v1alpha1
kind: TargetConnectionProfile
metadata:
  name: netconf
  namespace: default
  labels:
    dummy: dummy
spec:
  port: 830
  protocol: netconf
  encoding: ASCII
  skipVerify: true
  includeNS: true
  operationWithNS: true
---
apiVersion: inv.sdcio.dev/v1alpha1
kind: TargetSyncProfile
metadata:
  name: netconf-getconfig
  namespace: default
spec:
  buffer: 0
  workers: 10
  validate: true
  sync:
  - name: config
    protocol: netconf
    paths:
    - /
    mode: sample
    encoding: config
    interval: "10s"
---
apiVersion: inv.sdcio.dev/v1alpha1
kind: DiscoveryRule
metadata:
  name: dr-static
  namespace: default
spec:
  period: 1m
  concurrentScans: 2
  defaultSchema:
    provider: mx.juniper.sdcio.dev 
    version: 23.2R1
  addresses:
  - address: 192.168.100.100
    hostName: junos-central
  targetConnectionProfiles:
  - credentials: mx.juniper.sdcio.dev
    connectionProfile: netconf
    syncProfile: netconf-getconfig
  targetTemplate:
    labels:
      sdcio.dev/region: us-east

Schemas and targets shows READY

kubectl get schema
NAME                          READY   URL                                            REF        PROVIDER               VERSION
mx.juniper.23.2r1             True    https://github.com/Juniper/yang                master     mx.juniper.sdcio.dev   23.2R1

kubectl get targets.inv.sdcio.dev
NAME            READY   REASON   PROVIDER               ADDRESS               PLATFORM   SERIALNUMBER   MACADDRESS
junos-central   True             mx.juniper.sdcio.dev   192.168.100.100:830

But applying the following config:

apiVersion: config.sdcio.dev/v1alpha1
kind: Config
metadata:
  name: intent1-junos
  namespace: default
  labels:
    targetName: "junos-central"
    targetNamespace: "default"
spec:
  priority: 10
  config:
  - path: /
    value:
      configuration:
        interfaces:
          interface:
          - name: ge-0/0/0
            unit:
            - name: "0"
              family:
                inet:
                  address:
                  - name: "10.0.1.100/24"

Gives errors about target name and namespace

kubectl apply -f config.yaml
The Config "intent1-junos" is invalid: metadata.labels: Invalid value: v1alpha1.Config{TypeMeta:v1.TypeMeta{Kind:"Config", APIVersion:"config.sdcio.dev/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"intent1-junos", GenerateName:"", Namespace:"default", SelfLink:"", UID:"a8ead2c3-6230-438b-b9ec-74f37d20c453", ResourceVersion:"0", Generation:0, CreationTimestamp:time.Date(2024, time.July, 1, 20, 45, 58, 377316952, time.Local), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"targetName":"junos-central", "targetNamespace":"default"}, Annotations:map[string]string{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"config.sdcio.dev/v1alpha1\",\"kind\":\"Config\",\"metadata\":{\"annotations\":{},\"labels\":{\"targetName\":\"junos-central\",\"targetNamespace\":\"default\"},\"name\":\"intent1-junos\",\"namespace\":\"default\"},\"spec\":{\"config\":[{\"path\":\"/\",\"value\":{\"configuration\":{\"interfaces\":{\"interface\":[{\"name\":\"ge-0/0/0\",\"unit\":[{\"family\":{\"inet\":{\"address\":[{\"name\":\"10.0.1.100/24\"}]}},\"name\":\"0\"}]}]}}}}],\"priority\":10}}\n"}, OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry{v1.ManagedFieldsEntry{Manager:"kubectl-client-side-apply", Operation:"Update", APIVersion:"config.sdcio.dev/v1alpha1", Time:time.Date(2024, time.July, 1, 20, 45, 58, 377145898, time.UTC), FieldsType:"FieldsV1", FieldsV1:(*v1.FieldsV1)(0xc00920ac90), Subresource:""}}}, Spec:v1alpha1.ConfigSpec{Lifecycle:v1alpha1.Lifecycle{DeletionPolicy:""}, Priority:10, Config:[]v1alpha1.ConfigBlob{v1alpha1.ConfigBlob{Path:"/", Value:runtime.RawExtension{Raw:[]uint8{0x7b, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x67, 0x65, 0x2d, 0x30, 0x2f, 0x30, 0x2f, 0x30, 0x22, 0x2c, 0x22, 0x75, 0x6e, 0x69, 0x74, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x6e, 0x65, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x2e, 0x31, 0x30, 0x30, 0x2f, 0x32, 0x34, 0x22, 0x7d, 0x5d, 0x7d, 0x7d, 0x2c, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x30, 0x22, 0x7d, 0x5d, 0x7d, 0x5d, 0x7d, 0x7d, 0x7d}, Object:runtime.Object(nil)}}}}, Status:v1alpha1.ConfigStatus{ConditionedStatus:v1alpha1.ConditionedStatus{Conditions:[]v1alpha1.Condition(nil)}, LastKnownGoodSchema:(*v1alpha1.ConfigStatusLastKnownGoodSchema)(nil), AppliedConfig:(*v1alpha1.ConfigSpec)(nil), Deviations:[]v1alpha1.Deviation(nil)}}:  target namespace and name is required got .

Not sure what could wrong.

Thanks

infinitydon commented 4 months ago

Got the right CR from https://github.com/sdcio/sdcio-demo/blob/main/basic_usage/config01.yaml

I think the sample configuration at https://docs.sdcio.dev/examples/2_k8s_sros_collocated/#configure-intents should be updated to reflect the current configuration syntax.

henderiw commented 4 months ago

Yes we will update the docs, unless you want to do a PR for it?

On 1 Jul 2024, at 23:17, Christopher Adigun @.***> wrote:

Got the right CR from https://github.com/sdcio/sdcio-demo/blob/main/basic_usage/config01.yaml

I think the sample configuration at https://docs.sdcio.dev/examples/2_k8s_sros_collocated/#configure-intents should be updated to reflect the current configuration syntax.

— Reply to this email directly, view it on GitHub https://github.com/sdcio/docs/issues/59#issuecomment-2201089551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMXXVDZQMU75LEIWETQXPLZKHBP5AVCNFSM6AAAAABKGJCBPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGA4DSNJVGE. You are receiving this because you are subscribed to this thread.

infinitydon commented 4 months ago

Sure. Opened PR https://github.com/sdcio/docs/pull/61 to fix this

henderiw commented 4 months ago

Thx approved and merged. Appreciated

On Tue, 2 Jul 2024 at 17:25, Christopher Adigun @.***> wrote:

Sure. Opened PR #61 https://github.com/sdcio/docs/pull/61 to fix this

— Reply to this email directly, view it on GitHub https://github.com/sdcio/docs/issues/59#issuecomment-2203364653, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMXXVCQOHDRHWPAIHR7QJLZKKZ43AVCNFSM6AAAAABKGJCBPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBTGM3DINRVGM . You are receiving this because you commented.Message ID: @.***>