Re: 答复: Re some comments ALTO code


chenguohai
 

 

 

Dear all

 

That is my misunderstanding.

I have posted my previous question here(https://ask.opendaylight.org/question/3617/there-should-be-some-improvement-about-the-auto-generated-codes-from-yangtools/), but there is no answer now.

 

BR

Robert

-------------------------------------------------------------------------------------------------------------------------------------

Chen Guohai (Robert), 陈国海. Network Research Department, Huawei Technologies Co., Ltd. Telephone: 0086-25-56624606;

华为技术有限公司 ,地址:深圳市龙岗区坂田华为基地 邮编:518129 http://www.huawei.com

-------------------------------------------------------------------------------------------------------------------------------------

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the  information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

----------------------------------------------------------------------------------------------------------------------------------------

 

发件人: Gao Kai [mailto:godrickk@...]
发送时间: Thursday, May 07, 2015 8:48 AM
收件人: Chenguohai
抄送: alto-dev@...
主题: Re: Re [alto-dev] some comments ALTO code

 

Mr. Chen,

in().ipv4 is a list, so is in().ipv6.

On 07/05/15 08:31, Chenguohai wrote:

 

 

Hi  folks,

I am suspecting there are some constraints on AddressGroup which could most include one IPV4 and(or) one IPV6. The processing code in RFC2ModelEndpointAddressGroupCoventer.java seems only could cope with most one IPV4 and(or) one IPV6.

 

    @Override

    protected Object _convert() {

        List<ModelEndpointAddressGroup> out = new LinkedList<ModelEndpointAddressGroup>();

        if ((in().ipv4 != null) && (!in().ipv4.isEmpty())) {

            ModelEndpointAddressGroup v4 = new ModelEndpointAddressGroup();

            v4.setJSONAddressType(ModelEndpointAddressGroup.IPV4);

            v4.setJSONEndpointPrefix(in().ipv4);

            out.add(v4);

        }

        if ((in().ipv6 != null) && (!in().ipv6.isEmpty())) {

            ModelEndpointAddressGroup v6 = new ModelEndpointAddressGroup();

            v6.setJSONAddressType(ModelEndpointAddressGroup.IPV6);

            v6.setJSONEndpointPrefix(in().ipv6);

            out.add(v6);

        }

        return out;

    }

It is reseanable that one EP has multiple IPV4 addresses or multiple IPV6 addresses.

 

Did I misunderstand something .

 

BR

Robert

-------------------------------------------------------------------------------------------------------------------------------------

Chen Guohai (Robert), 陈国海. Network Research Department, Huawei Technologies Co., Ltd. Telephone: 0086-25-56624606;

华为技术有限公司 ,地址:深圳市龙岗区坂田华为基地 邮编:518129 http://www.huawei.com

-------------------------------------------------------------------------------------------------------------------------------------

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他 人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件 通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the  information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

----------------------------------------------------------------------------------------------------------------------------------------

 

发件人: Chenguohai
发送时间: Tuesday, May 05, 2015 3:39 PM
收件人: 'godrickk@...'
抄送: alto-dev@...
主题: Re [alto-dev] some comments ALTO code

 

Hi Kai,

 

Good proposal. I’ll try to find who is responsible for that.

There is another project(https://wiki.opendaylight.org/view/YANG_Tools:Main), may be the committers know the clue.

 

BR

Robert

发件人: Gao Kai [mailto:godrickk@...]
发送时间: Monday, May 04, 2015 11:00 PM
收件人: Chenguohai; alto-dev@...
主题: Re: [alto-dev] some comments ALTO code

 

Mr. Chen,

We appreciate your interest of ALTO and the effort to improve its performance.

For the record, however, the code are generated by yangtools automatically. A patch is still welcomed but I think you can report this to the yangtools group so that these issues can be solved, at least from my perspective of view, in a more general and elegant manner.

Thanks again for your work and we are glad to get feedback from the community.

Yours,

GK

On 04/05/15 17:20, Chenguohai wrote:

Hi folks,

 

I am reading the code under ALTO@ODL. And here are my two comments.

 

1:File named AltoProviderImplBuilderunder alto-provider/……./modules/module/configuration  :in function named  'toString',first is defined to judge a common should be inserted, i recommend writting as following

        @Override

        public java.lang.String toString() {

            java.lang.StringBuilder builder = new java.lang.StringBuilder ("AltoProviderImpl [");

            //boolean first = true;

       

            if (_dataBroker != null) {

                //if (first) {

                //    first = false;

                //} else {

                //    builder.append(", ");

                //}

                builder.append("_dataBroker=");

                builder.append(_dataBroker);

                builder.append(", ");//new added

 

             }

            if (_rpcRegistry != null) {

                //if (first) {

                //    first = false;

                //} else {

                //    builder.append(", ");

                //}

                builder.append("_rpcRegistry=");

                builder.append(_rpcRegistry);

                builder.append(", ");//new added

 

             }

            //if (first) {

            //    first = false;

            //} else {

            //    builder.append(", ");

            //}

            builder.append("augmentation=");

            builder.append(augmentation.values());

            return builder.append(']').toString();

        }

    }

Fewer judgement, fewer jumpes and simplified, consistent code,Make sense.

There are similar something in file named RpcRegistryBuilder.java under alto-provider/……../modules/module/configuration/alto/provider/impl

 

2:  File named YangModuleInfoImpl line36 there are duplicated something between $YangModuleInfoImpl method(line 30 to line 33) and getModuleSourceStream.YangModuleInfoImpl can call getModuleSourceStream to get a stream.

 

    private $YangModuleInfoImpl() {

        Set<YangModuleInfo> set = new HashSet<>();

        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.binding.rev131028.$YangModuleInfoImpl.getInstance());

        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.$YangModuleInfoImpl.getInstance());

        set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.$YangModuleInfoImpl.getInstance());

        importedModules = ImmutableSet.copyOf(set);

   

        //InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath);

        //if (stream == null) {

        //    throw new IllegalStateException("Resource '" + resourcePath + "' is missing");

        //}

        InputStream stream = getModuleSourceStream ();// new added one

        try {

            stream.close();

        } catch (IOException e) {

        // Resource leak, but there is nothing we can do

        }

}

 

BR

Robert

-------------------------------------------------------------------------------------------------------------------------------------

Chen Guohai (Robert), 陈国海. Network Research Department, Huawei Technologies Co., Ltd. Telephone: 0086-25-56624606;

华 为技术有限公司 ,地址:深圳市龙岗区坂田华为基地 邮编:518129 http://www.huawei.com

-------------------------------------------------------------------------------------------------------------------------------------

本 邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全 部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the  information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

----------------------------------------------------------------------------------------------------------------------------------------

 

 

_______________________________________________
alto-dev mailing list
alto-dev@...
https://lists.opendaylight.org/mailman/listinfo/alto-dev

 

 

Join z.archive.alto-dev@lists.opendaylight.org to automatically receive all group messages.